From patchwork Tue Oct 13 05:59:32 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: rnd@nic.fi X-Patchwork-Id: 7381481 X-Patchwork-Delegate: jikos@jikos.cz Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 09B09BEEA4 for ; Tue, 13 Oct 2015 06:05:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0F31320982 for ; Tue, 13 Oct 2015 06:05:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3355520980 for ; Tue, 13 Oct 2015 06:05:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751580AbbJMGFG (ORCPT ); Tue, 13 Oct 2015 02:05:06 -0400 Received: from gw01.mail.saunalahti.fi ([195.197.172.115]:51167 "EHLO gw01.mail.saunalahti.fi" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751449AbbJMGFF (ORCPT ); Tue, 13 Oct 2015 02:05:05 -0400 X-Greylist: delayed 330 seconds by postgrey-1.27 at vger.kernel.org; Tue, 13 Oct 2015 02:05:04 EDT Received: from cfwo-22-2.mail.saunalahti.fi (cfwo-22.mail.saunalahti.fi [62.142.5.121]) by gw01.mail.saunalahti.fi (Postfix) with ESMTP id DF4E64002E for ; Tue, 13 Oct 2015 08:59:32 +0300 (EEST) Received: from localhost (localhost [127.0.0.1]) by cfwo-22-2.mail.saunalahti.fi (Postfix) with ESMTP id CDB8120076 for ; Tue, 13 Oct 2015 08:59:32 +0300 (EEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from webmail.elisa.fi (wm-web11.pa.saunalahti.fi [195.197.1.102]) by cfwo-22-2.mail.saunalahti.fi (Postfix) with ESMTP id 3279620072; Tue, 13 Oct 2015 08:59:32 +0300 (EEST) MIME-Version: 1.0 Date: Tue, 13 Oct 2015 08:59:32 +0300 From: rnd@nic.fi To: linux-input@vger.kernel.org Cc: jikos@kernel.org Subject: [PATCH] HID: reject input outside logical range only if null state is set Message-ID: <01431f646f00a0ce0995e07578b61bae@be13.mail.saunalahti.fi> X-Sender: rnd@nic.fi User-Agent: Elisa Webmail/1.0 X-Originating-IP: 221.221.149.14 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 Kernel 3.19.0 one-line fix for an issue in drivers/hid/hid-input.c where USB HID control null state flag is not checked when rejecting inputs outside logical minimum-maximum range. The check should be made as per USB HID specification 1.11, section 6.2.2.5, p.31. I have no resources for large-scale testing, but this fixes problems with the game controller I have (INNEX NES Controller USB). More details: https://bugzilla.kernel.org/show_bug.cgi?id=68621 Signed-Off-by: Valtteri Heikkilä --- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- a/drivers/hid/hid-input.c 2015-05-25 09:58:49.743527141 +0800 +++ b/drivers/hid/hid-input.c 2015-05-25 11:04:13.201191432 +0800 @@ -1097,6 +1097,7 @@ * 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)) {