Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp468164ybl; Tue, 28 Jan 2020 06:26:26 -0800 (PST) X-Google-Smtp-Source: APXvYqxieQLIWIPc/TnWJXUPFtpu7JXuBfTN3/GD984zPBQmOT6mLpJNcihAfaNHn3lh9Uj3O9q/ X-Received: by 2002:a9d:729c:: with SMTP id t28mr13669164otj.66.1580221586055; Tue, 28 Jan 2020 06:26:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580221586; cv=none; d=google.com; s=arc-20160816; b=faMmyHsPGmgw9rGAcmALTSyFaVL4CDaCPB6hVsHd7fWTYvDb880MpM9mk72C54GWzP DjVWESYgx5AIRABV8TmgIVM1RaylL/5EQawJMqPhDpbzhpt6DKjhjga73Bb4RKjadaDH eXQuTUdrYK10vjaedF7SNvef9/ClNynz9Q0mJbaHsFfn8Mp9wFD2Vm4upStmeV7ocR/Q miVmgGXMNLnyL5ONYX1rxET2QBvsgGtWKzn14GqY8BRlnE5M1/eZ+V2re5AZi4An0IUl f7zXMj65UnQGyzlM8WUpzHrcUiQ6uqlCTokMraHcw2prBiON0FUmrxh64yoFpsNSEzbL OAtg== 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=B1pVuK462oLmEVXEv6461JUzjIp2Vvdm6UJdRCy6X9U=; b=PJWFnX1nUng4h3Jrytp9RACG8bQYhpYXx9WHL27EpnFEJry9KkcKYO66efFPjPwdcR VMPfrIP3/SQiJ0KFmaK6mz9bKZRR9NryL7iqDf/I/1ojFR3xBWUso6gORKiNNK+g5jGS WOGdWSpgW6c6CRxR5i5C6GumLN+UJ7uwoeQdFG9K6TGtA0j6eYPO+cl2ZTlOlHPTBTmw NlKdB1JaMc3LayTsrUY8pGQkOeOQfQwk+n4y4ysTRgnAtRmn8NjPs62FBiWvWKka7VWs 6/BCTTJSPltZGavnxRWW3bv2C1UUAUFel2kXNmqdpU6+08FD2tfUUcKiBeYlKNkqhxXE 6kTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=RJRCAClg; 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 b10si4901519oic.153.2020.01.28.06.26.14; Tue, 28 Jan 2020 06:26:26 -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=RJRCAClg; 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 S1729857AbgA1OZP (ORCPT + 99 others); Tue, 28 Jan 2020 09:25:15 -0500 Received: from mail.kernel.org ([198.145.29.99]:52110 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732471AbgA1OZN (ORCPT ); Tue, 28 Jan 2020 09:25:13 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.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 4BA572071E; Tue, 28 Jan 2020 14:25:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1580221512; bh=6Zf7WpmE37b/Hbx0ZBYx+MP+UHtZ5PHCF50LJoYk9ZQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RJRCAClgeh+HR9u/Xx9kng1cxVMCU9U+BHzDZmWDGOFOHc7aOJXGaaaFzfYZWGySr AjWcznaT0j1eTTuHmzjSQUdQIwpQqqGxNzkeyS03rfRVIOrbXJAA/dmzH7eOs6p3+u cTTI2xyhvVxwhWU5wdwLbcOYUsM1sG30oAObYieo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johan Hovold , Vladis Dronov , Dmitry Torokhov Subject: [PATCH 4.9 254/271] Input: aiptek - fix endpoint sanity check Date: Tue, 28 Jan 2020 15:06:43 +0100 Message-Id: <20200128135911.487974997@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200128135852.449088278@linuxfoundation.org> References: <20200128135852.449088278@linuxfoundation.org> User-Agent: quilt/0.66 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 From: Johan Hovold commit 3111491fca4f01764e0c158c5e0f7ced808eef51 upstream. The driver was checking the number of endpoints of the first alternate setting instead of the current one, something which could lead to the driver binding to an invalid interface. This in turn could cause the driver to misbehave or trigger a WARN() in usb_submit_urb() that kernels with panic_on_warn set would choke on. Fixes: 8e20cf2bce12 ("Input: aiptek - fix crash on detecting device without endpoints") Signed-off-by: Johan Hovold Acked-by: Vladis Dronov Link: https://lore.kernel.org/r/20191210113737.4016-3-johan@kernel.org Signed-off-by: Dmitry Torokhov Signed-off-by: Greg Kroah-Hartman --- drivers/input/tablet/aiptek.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/drivers/input/tablet/aiptek.c +++ b/drivers/input/tablet/aiptek.c @@ -1822,14 +1822,14 @@ aiptek_probe(struct usb_interface *intf, input_set_abs_params(inputdev, ABS_WHEEL, AIPTEK_WHEEL_MIN, AIPTEK_WHEEL_MAX - 1, 0, 0); /* Verify that a device really has an endpoint */ - if (intf->altsetting[0].desc.bNumEndpoints < 1) { + if (intf->cur_altsetting->desc.bNumEndpoints < 1) { dev_err(&intf->dev, "interface has %d endpoints, but must have minimum 1\n", - intf->altsetting[0].desc.bNumEndpoints); + intf->cur_altsetting->desc.bNumEndpoints); err = -EINVAL; goto fail3; } - endpoint = &intf->altsetting[0].endpoint[0].desc; + endpoint = &intf->cur_altsetting->endpoint[0].desc; /* Go set up our URB, which is called when the tablet receives * input.