Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp468276ybl; Tue, 28 Jan 2020 06:26:31 -0800 (PST) X-Google-Smtp-Source: APXvYqzQ/w+mAuAkeRbd7rfGN2HwRzTT1AOpc0cdtPZVhNpA2LW5R9jHhFsim2tbfaV8EKsKE+Gv X-Received: by 2002:a9d:6c06:: with SMTP id f6mr17014128otq.318.1580221591522; Tue, 28 Jan 2020 06:26:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580221591; cv=none; d=google.com; s=arc-20160816; b=lnTiMPyFssTJw4ZTwu9QLE6JxVnofuk8t1/ntD1jaK6b032q2I6hTB/wTdqwtXXJI+ q2jmYzDaC9fSHifsSKZARfUi9lKKLf4gKd6qwjNFEkMIg7VGq4dMvH0W9UNcv7j5+AdA 4i7MR6DMzgYCbh7PH7q5jkOxAI88x1hxU13WbEItX3vEekWGyGMeY7gxwQoT4NulPl9y FtfiXL6bB70zZSQLtF04X+BMTuIms5axxfaMp/Vv1+bYfcCtkFASS1ZBuNJq+AyoanW+ ZH5TqRmfr0JF2ghmeA1QEfVhqYkhi6OeXxmJuHAo0QS8NZdnD+tcmrXWsWWS0/Duhq9A Mg5A== 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=fdyubBhS8P4BUbxCCiFak3q1ljVT67jTAhsUqxnaJ/I=; b=01CbjoMPZg4CbTInc6ZcVXp5uqAAZzFs25G33HHgHZv0GvuJDD7PFxW7nhdNl5ylGw rDvxIqi4p0DiWKuqDVZ53EsWj/uACByig9U7rioxFI1CxumRZItN8y+Y6+IVkTKp4IF0 Y50dmvLHee7MHgNs+gKonKGzW2msnUzMmuWTIBMEYjPlucRgNCkejincr9Fjc3K868Nk 1dZOYon4nqEsOJmPBp+CUIcrXUibH3uy+A1/xnO49TBcAr5FOwX2GQ+1uyinK3sgeZCm Zde5hig3J+lxqpZYi/kSkSnHrQ5JH2cFE64ARXPaRHlpgOwMeXCL5AOpm8pbj3vW/OKC J7IA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=QbCyC021; 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 t185si5072498oib.39.2020.01.28.06.26.19; Tue, 28 Jan 2020 06:26:31 -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=QbCyC021; 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 S1730216AbgA1OZS (ORCPT + 99 others); Tue, 28 Jan 2020 09:25:18 -0500 Received: from mail.kernel.org ([198.145.29.99]:52172 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730397AbgA1OZP (ORCPT ); Tue, 28 Jan 2020 09:25:15 -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 C49EA21739; Tue, 28 Jan 2020 14:25:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1580221515; bh=TQM9MwrWosBxaOXUgZjjsrwBjU237+BVRe82b9oiL+Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QbCyC02114iEaIRhek2BxHZlarj//VuERl7LNkl888XjY6JiWt9BHinmUVIj7ci8k Hl+zxuMMorfG+lvjN8UT8a2vdszM7mYOuDt8WROdiei1FY6BtCKNMF5KBq4tImtdmB secptJyJAa4zU08ACCNDtRzROXAYwh6EtJbvZFxg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johan Hovold , Martin Kepplinger , Vladis Dronov , Dmitry Torokhov Subject: [PATCH 4.9 255/271] Input: pegasus_notetaker - fix endpoint sanity check Date: Tue, 28 Jan 2020 15:06:44 +0100 Message-Id: <20200128135911.576746222@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 bcfcb7f9b480dd0be8f0df2df17340ca92a03b98 upstream. The driver was checking the number of endpoints of the first alternate setting instead of the current one, something which could be used by a malicious device (or USB descriptor fuzzer) to trigger a NULL-pointer dereference. Fixes: 1afca2b66aac ("Input: add Pegasus Notetaker tablet driver") Signed-off-by: Johan Hovold Acked-by: Martin Kepplinger Acked-by: Vladis Dronov Link: https://lore.kernel.org/r/20191210113737.4016-2-johan@kernel.org Signed-off-by: Dmitry Torokhov Signed-off-by: Greg Kroah-Hartman --- drivers/input/tablet/pegasus_notetaker.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/input/tablet/pegasus_notetaker.c +++ b/drivers/input/tablet/pegasus_notetaker.c @@ -260,7 +260,7 @@ static int pegasus_probe(struct usb_inte return -ENODEV; /* Sanity check that the device has an endpoint */ - if (intf->altsetting[0].desc.bNumEndpoints < 1) { + if (intf->cur_altsetting->desc.bNumEndpoints < 1) { dev_err(&intf->dev, "Invalid number of endpoints\n"); return -EINVAL; }