Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3328343imu; Sun, 11 Nov 2018 12:28:59 -0800 (PST) X-Google-Smtp-Source: AJdET5esPYvhCF41VNX88ZEBZyDI7arAkX/d3zzqtnO+BFU+bTYGvfEPlrFNLU93gPrjkGsBiwDY X-Received: by 2002:a63:7cf:: with SMTP id 198mr15341998pgh.129.1541968139146; Sun, 11 Nov 2018 12:28:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541968139; cv=none; d=google.com; s=arc-20160816; b=ZxMYMYQNIbDbW6tBaIRA3ofkMmL8DJZHjWSUy/cvAomMXQyEC2DknUABwScTnxXTiK jUlI63miyhvhPpXZl5UIDSdPTx+JPbwoKMA4n2fNivllIvUicQNbSGCDc4FoW8qOgmpW +V2m0Dhz6uLhZiJt1EsNgJoIgohlY3KRadhoOwnHvDATaZ3/k+pJb+qmhl2Agp2hcbWY KD7OE5WcfvNloLcxOXhLdMrjZizSTlLTPFzlTsJKuz0l0WMjg2k4+4WdAYiZaQ+Qd3tS O0ytCGJCg1SK3vZnW8Im4SIAwbVhvKzzB/6rfuF4OmIgYnT9227rycXKKFBRiAbn+dCX wkqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition; bh=b2ZJPHG8AgJywYuEF+vxQwdul9ZSKiT4tAsF9jIQ6bw=; b=Jx46jBfO5TOL72UWZL1UWmVPi7R+nFYVuKZppeZkmUd8e/lgQCr70ynTRi5dsjy1nY bpUir1hIGFHEWNhY0YKWpr4YwYMFObngNrWuX9vD1MyqINJ4zcZ44uN8riip3+Mshprv beYqYAzKoye0w24Bt1gWuMHmn5e4bljpaD4rLK7OjWH4KsNk6057nh2Culf+OdqqILr5 Y0HpdsnZ9m9C806xYPH1GhZaRgpKdthCxZe4PLr7BrL6SeAAbVeJmWGHa76j9bfmqFbT tTKInF45WrIH+Kkq8Cq1jmFG+zMi71hbD2FShG1/q9s8BR2+A4/7s9VUF5LG6CkSdcLk a1Vg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x142si13455524pgx.202.2018.11.11.12.28.44; Sun, 11 Nov 2018 12:28:59 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731079AbeKLGRw (ORCPT + 99 others); Mon, 12 Nov 2018 01:17:52 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:50640 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730521AbeKLFsX (ORCPT ); Mon, 12 Nov 2018 00:48:23 -0500 Received: from [192.168.4.242] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gLvsi-0000lJ-97; Sun, 11 Nov 2018 19:58:52 +0000 Received: from ben by deadeye with local (Exim 4.91) (envelope-from ) id 1gLvsa-0001qs-0S; Sun, 11 Nov 2018 19:58:44 +0000 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Benjamin Tissoires" , "Tomasz Kramkowski" , "=?UTF-8?q?Valtteri=20Heikkil=C3=A4?=" , "Jiri Kosina" Date: Sun, 11 Nov 2018 19:49:05 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 333/366] HID: reject input outside logical range only if null state is set In-Reply-To: X-SA-Exim-Connect-IP: 192.168.4.242 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.61-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Valtteri Heikkilä commit 3f3752705dbd50b66b66ad7b4d54fe33d2f746ed upstream. 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 Acked-By: Benjamin Tissoires Signed-off-by: Jiri Kosina Signed-off-by: Ben Hutchings --- drivers/hid/hid-input.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/hid/hid-input.c +++ b/drivers/hid/hid-input.c @@ -1094,6 +1094,7 @@ void hidinput_hid_event(struct hid_devic * 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)) {