Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp449213ybl; Tue, 28 Jan 2020 06:10:15 -0800 (PST) X-Google-Smtp-Source: APXvYqzXk94BYmqAX7eUB5GzLuz2CCtOcLEAEC1PIXH4T7m8E4Aup68VAYc67dur6clLBnbKLw/i X-Received: by 2002:aca:4ace:: with SMTP id x197mr2938760oia.23.1580220615547; Tue, 28 Jan 2020 06:10:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580220615; cv=none; d=google.com; s=arc-20160816; b=xJJA/EHcTB/vd8IvOCn8IGlYIu/QEOeohIu2wktCwdyiAs69pU9/X9FQP7Lc0G3nag cPV4CHDUp5PrnymE4aCNwUJ5fcCrSOjjvumQcQ6zupoBGwGLfYmCx5lTJRgIASNZK2Lc 8/IGgE7XfpZeSIRPrM+m+vMDoEl7t4bvdC3CrvoxxBI7OIrCvVV63juD8VcINeuz9Ot4 /Y4i+dwAoWRHsNK2lPfdTSabU4817WzW9CyCPFfL0A/AG2aYlB5d7raX3ftHHdTk4PZH vWouBfh4VrhKCqhnX4Q8ewS6bZrXnoTLW1NX3ABjxcPAuuSRGU7mVDl+XalZQhiiZp5x gcwQ== 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=CUWkVd1Ha3Z4Hp4kKGUJkbHgtcuMsW60rNr5XHbIS6M=; b=a6JL8ks6I7FXW1Nw3X0iqaAe9AHfuEExMqAMhWfBgTV6fQLVIVI0CaNPaGRJnzttuw bQdotfABtoAs1DO9FasLVC1jFCe65RmpyW46t93IZHgNRl4dz6MEEr57Z95iWsfK1QQ6 lmxjcS/to8ecaRX4c7KlKnAMB8WXAkDaz8mC+FwRWv2ez3+v6tPvT8NfEpjFQ7KYt8U/ X7n6fXIGxeFfryk0ex0W75Rh4Itu6qASV+1ZGFZpXYbNtjhvD+dLJNOjHpG0otEhCJRB bQoibPlYVEU2Fuat7dSwhACz4y2HNi2h4tccrjz3/Hz2SE8XLsOjSSn3iL2wMx7zNvu0 UcLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=KrAjLKqW; 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 w26si8316367otl.213.2020.01.28.06.09.59; Tue, 28 Jan 2020 06:10:15 -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=KrAjLKqW; 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 S1727961AbgA1OD5 (ORCPT + 99 others); Tue, 28 Jan 2020 09:03:57 -0500 Received: from mail.kernel.org ([198.145.29.99]:50670 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727257AbgA1ODr (ORCPT ); Tue, 28 Jan 2020 09:03:47 -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 A510B205F4; Tue, 28 Jan 2020 14:03:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1580220227; bh=3WYhliuMA03MBRGzECpdvCSDV9LUr6dptENYDYnfFzE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KrAjLKqWuENMVQjVn+EAxzAaVJTDv1jtWwWnzG/ZShF2kxrYTwpwarXOe1zhWDzNy /sLAHDkWdP6CAbxvLqS6KGHhzH+4sPWnTmLU2l0mf8FjH0+o6S54BeowrgcFcx5dYL QoRshP9RTLTLVZFDFS5FVy1qattuqudS6cU92I0Q= 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 5.4 067/104] Input: aiptek - fix endpoint sanity check Date: Tue, 28 Jan 2020 15:00:28 +0100 Message-Id: <20200128135826.692736640@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200128135817.238524998@linuxfoundation.org> References: <20200128135817.238524998@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 @@ -1802,14 +1802,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.