Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2517136imu; Thu, 29 Nov 2018 06:17:58 -0800 (PST) X-Google-Smtp-Source: AFSGD/Xtya8zG8QeAq9H70aFFAKYw+rE9/BBOAp2VcdUiwYV+NVPO/B3cmaUfDuVr/uCt3vwPH8u X-Received: by 2002:a17:902:8c98:: with SMTP id t24mr1652854plo.130.1543501078491; Thu, 29 Nov 2018 06:17:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543501078; cv=none; d=google.com; s=arc-20160816; b=q1jkmHEi2AImrdt6/A0b6kktWDN5ccPwmnSci8oSeytDd2J298QVuRlb/pwS03jHny 3fL2G/tvYwQBKWNY6JCd0Zao/wOWZbZtNyyJCK20rjNQVXetF8qcojpa4TwP5qpxw+iw och8GnHCPIQPp+BzZirUtkV/xMKY5BrCVs0yhFBA2jlVLkKJKfoe850mGHGQyV24ZFkS 0tMCQo20wNY7huvmC6QPYNsJm71aE2WorAQ0Bd/Fvcgex1mXRSMOf5Lvt0XEs4iZYiqX esbH/kDNl84ohIY8vklOktnZSvz87kxHaCzcfWOJSO9RWLyNpY0Xc4HPpftum7Aap0mL LnuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=aHmLaOm03EUNnjl1lQh1yPK5iabPOjxCaCdx6KbND6o=; b=K7/AfHfgGBPWwV1R2giXaa1iatcV3M4YKhA5jJ+vvtAjA0wSs8Cu9pCRsZqJAloX1B bv3U9rBKbganoI2HkGdoXdCjnuA0ePey1lCMROOX4seBqsIWDA1ZFdjTjPLkADJxeIZI /0DldITqjttQLOyEkKo8h8GtfeF0O4xVnWIQ39Zygd6P736VBG360SMFaAOE5Ewd0WAk QRf2JfOC1LMHUaJbNV74d8pJQliIer7TKQyfiw7dEV1W6AOPrZFtit3W5IU77ar5P7qU Qfh6g4kIh62dhraoukR9JoNcikigh2iylkJQkusYgp8/s8pjayKirfoBuQEzTjz12e3m sekA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="iq/LQfbx"; 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 u6si2499150pfb.92.2018.11.29.06.17.43; Thu, 29 Nov 2018 06:17:58 -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; dkim=pass header.i=@kernel.org header.s=default header.b="iq/LQfbx"; 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 S1729424AbeK3BUa (ORCPT + 99 others); Thu, 29 Nov 2018 20:20:30 -0500 Received: from mail.kernel.org ([198.145.29.99]:41432 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729379AbeK3BU3 (ORCPT ); Thu, 29 Nov 2018 20:20:29 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id EADA221104; Thu, 29 Nov 2018 14:14:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1543500899; bh=SuavPrg/c5YMZmK4yL/YNVzmx8brJayaetYepH3of6I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iq/LQfbxMEiBzXxyp662aZ3vp1Da3l+lJHyLM8tIUarc4293x4OF1AsA2vQ3gWG4G leGmN+LojV1f0wxZ0ER4JDpzz0Tt1srt2o93UF4k6oVMtAVRvNxIHcE4bfqsx7dOrH wIl4QgJl9Fmef2c6sDfr3ppoJh+oaBHFjYEPruEM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Cameron Gutman , Pavel Rojtberg , Dmitry Torokhov , Sasha Levin Subject: [PATCH 3.18 44/83] Input: xpad - prevent spurious input from wired Xbox 360 controllers Date: Thu, 29 Nov 2018 15:12:02 +0100 Message-Id: <20181129140140.237998470@linuxfoundation.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181129140138.002176596@linuxfoundation.org> References: <20181129140138.002176596@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.18-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit 1ff5fa3c6732f08e01ae12f12286d4728c9e4d86 ] After initially connecting a wired Xbox 360 controller or sending it a command to change LEDs, a status/response packet is interpreted as controller input. This causes the state of buttons represented in byte 2 of the controller data packet to be incorrect until the next valid input packet. Wireless Xbox 360 controllers are not affected. Writing a new value to the LED device while holding the Start button and running jstest is sufficient to reproduce this bug. An event will come through with the Start button released. Xboxdrv also won't attempt to read controller input from a packet where byte 0 is non-zero. It also checks that byte 1 is 0x14, but that value differs between wired and wireless controllers and this code is shared by both. I think just checking byte 0 is enough to eliminate unwanted packets. The following are some examples of 3-byte status packets I saw: 01 03 02 02 03 00 03 03 03 08 03 00 Signed-off-by: Cameron Gutman Signed-off-by: Pavel Rojtberg Cc: stable@vger.kernel.org Signed-off-by: Dmitry Torokhov Signed-off-by: Sasha Levin --- drivers/input/joystick/xpad.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c index c8add0e425b5..43b09dbacee6 100644 --- a/drivers/input/joystick/xpad.c +++ b/drivers/input/joystick/xpad.c @@ -459,6 +459,10 @@ static void xpad_process_packet(struct usb_xpad *xpad, u16 cmd, unsigned char *d static void xpad360_process_packet(struct usb_xpad *xpad, struct input_dev *dev, u16 cmd, unsigned char *data) { + /* valid pad data */ + if (data[0] != 0x00) + return; + /* digital pad */ if (xpad->mapping & MAP_DPAD_TO_BUTTONS) { /* dpad as buttons (left, right, up, down) */ -- 2.17.1