linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tomasz Kramkowski <tk@the-tk.com>
To: Jiri Kosina <jikos@kernel.org>
Cc: "Benjamin Tissoires" <benjamin.tissoires@redhat.com>,
	linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Valtteri Heikkilä" <rnd@nic.fi>,
	"Tomasz Kramkowski" <tk@the-tk.com>
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	[thread overview]
Message-ID: <20170214231433.27060-2-tk@the-tk.com> (raw)
In-Reply-To: <20170214231433.27060-1-tk@the-tk.com>

From: Valtteri Heikkilä <rnd@nic.fi>

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ä <rnd@nic.fi>
Signed-off-by: Tomasz Kramkowski <tk@the-tk.com>
---
 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)) {
-- 
2.11.0

  reply	other threads:[~2017-02-14 23:21 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-14 23:14 [PATCH v2 0/2] patches for Innomedia INNEX GENESIS/ATARI adapter Tomasz Kramkowski
2017-02-14 23:14 ` Tomasz Kramkowski [this message]
2017-03-06 13:04   ` [PATCH v2 1/2] HID: reject input outside logical range only if null state is set Jiri Kosina
2017-02-14 23:14 ` [PATCH v2 2/2] HID: usbhid: add quirk for innomedia INNEX GENESIS/ATARI adapter Tomasz Kramkowski
2017-03-06 13:04   ` Jiri Kosina
2017-03-03 16:15 ` [PATCH v2 0/2] patches for Innomedia " Benjamin Tissoires
2017-03-04 10:19   ` Tomasz Kramkowski
2017-03-06  9:04     ` Benjamin Tissoires
2017-03-07 13:10       ` Tomasz Kramkowski
2017-03-08 14:05         ` Jiri Kosina

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170214231433.27060-2-tk@the-tk.com \
    --to=tk@the-tk.com \
    --cc=benjamin.tissoires@redhat.com \
    --cc=jikos@kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rnd@nic.fi \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).