From patchwork Thu Aug 7 02:52:31 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: simon@mungewell.org X-Patchwork-Id: 4689141 X-Patchwork-Delegate: jikos@jikos.cz Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 7986B9F375 for ; Thu, 7 Aug 2014 03:02:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A67C3201DC for ; Thu, 7 Aug 2014 03:02:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9F67F201BA for ; Thu, 7 Aug 2014 03:02:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754563AbaHGDCI (ORCPT ); Wed, 6 Aug 2014 23:02:08 -0400 Received: from smtp-out-02.shaw.ca ([64.59.136.138]:3144 "EHLO smtp-out-02.shaw.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754510AbaHGDCH (ORCPT ); Wed, 6 Aug 2014 23:02:07 -0400 X-Greylist: delayed 573 seconds by postgrey-1.27 at vger.kernel.org; Wed, 06 Aug 2014 23:02:07 EDT X-Cloudmark-SP-Filtered: true X-Cloudmark-SP-Result: v=1.1 cv=W0/jygPWOP4vNGB1giqMd6hViTlTWopR5z2gXdBWnF4= c=1 sm=1 a=VeS-mf-K6mcA:10 a=EJEADgB2CZsA:10 a=3762yOXauukA:10 a=BLceEmwcHowA:10 a=x/GiHf5VU5uXFAeKKVSXKg==:17 a=HlPRHPCHw5Ts0-oRL6QA:9 a=HpAAvcLHHh0Zw7uRqdWCyQ==:117 Received: from unknown (HELO localhost.localdomain) ([70.72.56.65]) by smtp-out-02.shaw.ca with ESMTP; 06 Aug 2014 20:52:33 -0600 From: Simon Wood To: linux-input@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Jiri Kosina , Simon Wood Subject: [PATCH] HID:hid-logitech: Prevent possibility of infinite loop when using /sys interface Date: Wed, 6 Aug 2014 20:52:31 -0600 Message-Id: <1407379951-7038-1-git-send-email-simon@mungewell.org> X-Mailer: git-send-email 1.9.1 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP If the device data is not accessible for some reason, returning 0 will cause the call to be continuously called again as none of the string has been 'consumed'. --- drivers/hid/hid-lg4ff.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/hid/hid-lg4ff.c b/drivers/hid/hid-lg4ff.c index cc2bd20..7835717 100644 --- a/drivers/hid/hid-lg4ff.c +++ b/drivers/hid/hid-lg4ff.c @@ -451,13 +451,13 @@ static ssize_t lg4ff_range_store(struct device *dev, struct device_attribute *at drv_data = hid_get_drvdata(hid); if (!drv_data) { hid_err(hid, "Private driver data not found!\n"); - return 0; + return -EINVAL; } entry = drv_data->device_props; if (!entry) { hid_err(hid, "Device properties not found!\n"); - return 0; + return -EINVAL; } if (range == 0)