From patchwork Tue Feb 14 23:14:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tomasz Kramkowski X-Patchwork-Id: 9573055 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 53C4F6045F for ; Tue, 14 Feb 2017 23:21:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4AA7A2841E for ; Tue, 14 Feb 2017 23:21:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3DE6128429; Tue, 14 Feb 2017 23:21:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A5CD02841E for ; Tue, 14 Feb 2017 23:21:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751336AbdBNXVb (ORCPT ); Tue, 14 Feb 2017 18:21:31 -0500 Received: from erebus.the-tk.com ([109.74.205.187]:58272 "EHLO erebus.the-tk.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751023AbdBNXV3 (ORCPT ); Tue, 14 Feb 2017 18:21:29 -0500 X-Greylist: delayed 397 seconds by postgrey-1.27 at vger.kernel.org; Tue, 14 Feb 2017 18:21:24 EST Received: from erebus.the-tk.com (localhost [127.0.0.1]) by erebus.the-tk.com (OpenSMTPD) with ESMTP id 052d0dab; Tue, 14 Feb 2017 23:14:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=the-tk.com; h=from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-type:content-transfer-encoding; s=sel0; bh=dt/5OUUuVxtP YcIswvfQ/9bGoG8=; b=B9W00oAjiRJ0dg9DW6c2YIQUJKAkHDqTTqYh8q4Acker 3jxn+Svv/51Soegs0I8cqH7adRxXkiB9lIh+v5N4isF92CJ2Sm5Z07g5anV1BnmZ jHcZTCh5+0iL825tItu2wGtZ/IY3EuyVdvP3YXdeyhQRtN64Zz/0hQ/NJ96vpY8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=the-tk.com; h=from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-type:content-transfer-encoding; q=dns; s=sel0; b=dr2GR7 dtwk0iRIqX4xTL+ejBUqBK9SHDs5awPuxwV+iI29TN6zV0sATeqj4QKOFQJ20sJr QAErEZp1OhaQQ40RnfLWvJygwU4aF1huRodxKdu2EeayyPhZNEKzEYkIopJ/5P6N YIA6Q62QVmvuxA5/XWGdTrLvA3k0SprazLRJw= Received: from localhost (cpc1-nott20-2-0-cust508.12-2.cable.virginm.net [82.4.129.253]) by erebus.the-tk.com (OpenSMTPD) with ESMTPSA id 2b9b7842 (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256:NO); Tue, 14 Feb 2017 23:14:47 +0000 (UTC) From: Tomasz Kramkowski To: Jiri Kosina Cc: Benjamin Tissoires , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, =?UTF-8?q?Valtteri=20Heikkil=C3=A4?= , Tomasz Kramkowski Subject: [PATCH v2 1/2] HID: reject input outside logical range only if null state is set Date: Tue, 14 Feb 2017 23:14:32 +0000 Message-Id: <20170214231433.27060-2-tk@the-tk.com> X-Mailer: git-send-email 2.11.1 In-Reply-To: <20170214231433.27060-1-tk@the-tk.com> References: <20170214231433.27060-1-tk@the-tk.com> MIME-Version: 1.0 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Valtteri Heikkilä This patch fixes an issue in drivers/hid/hid-input.c where USB HID control null state flag is not checked upon rejecting inputs outside logical minimum-maximum range. The check should be made according to USB HID specification 1.11, section 6.2.2.5, p.31. The fix will resolve issues with some game controllers, such as: https://bugzilla.kernel.org/show_bug.cgi?id=68621 [tk@the-tk.com: shortened and fixed spelling in commit message] Signed-off-by: Valtteri Heikkilä Signed-off-by: Tomasz Kramkowski --- drivers/hid/hid-input.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c index d05f903c7614..cf8256aac2bd 100644 --- a/drivers/hid/hid-input.c +++ b/drivers/hid/hid-input.c @@ -1157,6 +1157,7 @@ void hidinput_hid_event(struct hid_device *hid, struct hid_field *field, struct * don't specify logical min and max. */ if ((field->flags & HID_MAIN_ITEM_VARIABLE) && + (field->flags & HID_MAIN_ITEM_NULL_STATE) && (field->logical_minimum < field->logical_maximum) && (value < field->logical_minimum || value > field->logical_maximum)) {