From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B717EC433FF for ; Wed, 14 Aug 2019 02:19:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8570D214DA for ; Wed, 14 Aug 2019 02:19:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565749159; bh=N05KwxBBON9wZR6VzW1kSG+0jp+4y/di9RoKzzO4QyE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=SBvr7pIKboEQHUzq425BMXEYF7jf5UOzZBVBo6TSGvqJbCmIYfQ9XtQ/z51u7rn/9 GdFg0rkRgPSfBWvTuIOLmBxIAPR8VnkI13wHijxK2MiYFCN/YHqTW+7HSu42X1oIoT 6UOCeS4+kQqMMNxlXfbjvrVklrG3e3yfjJQ+2CRY= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729686AbfHNCTR (ORCPT ); Tue, 13 Aug 2019 22:19:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:50048 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729648AbfHNCTL (ORCPT ); Tue, 13 Aug 2019 22:19:11 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BA1112084D; Wed, 14 Aug 2019 02:19:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565749150; bh=N05KwxBBON9wZR6VzW1kSG+0jp+4y/di9RoKzzO4QyE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vHPZ+iA+G6XU0uTxgHHqSg7J8ujgHNn0z9zp/mmKEHnt+HusuD286vlR816jT3MA9 6OBvtH1oOHl5/BWu6HVBCm/iq36vVAC5Qn+7mjEYWBFKGVIVzo4JcvCgiWZv5BR8ZZ Ghjt1WeRvLRXZruKvBpMeaYd3n0w++SCoecZs32M= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Oliver Neukum , syzbot+c7df50363aaff50aa363@syzkaller.appspotmail.com, Dmitry Torokhov , Sasha Levin , linux-input@vger.kernel.org Subject: [PATCH AUTOSEL 4.14 21/44] Input: kbtab - sanity check for endpoint type Date: Tue, 13 Aug 2019 22:18:10 -0400 Message-Id: <20190814021834.16662-21-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190814021834.16662-1-sashal@kernel.org> References: <20190814021834.16662-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Oliver Neukum [ Upstream commit c88090dfc84254fa149174eb3e6a8458de1912c4 ] The driver should check whether the endpoint it uses has the correct type. Reported-by: syzbot+c7df50363aaff50aa363@syzkaller.appspotmail.com Signed-off-by: Oliver Neukum Signed-off-by: Dmitry Torokhov Signed-off-by: Sasha Levin --- drivers/input/tablet/kbtab.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/input/tablet/kbtab.c b/drivers/input/tablet/kbtab.c index a41c3ff7c9afa..705f38c12acb8 100644 --- a/drivers/input/tablet/kbtab.c +++ b/drivers/input/tablet/kbtab.c @@ -125,6 +125,10 @@ static int kbtab_probe(struct usb_interface *intf, const struct usb_device_id *i if (intf->cur_altsetting->desc.bNumEndpoints < 1) return -ENODEV; + endpoint = &intf->cur_altsetting->endpoint[0].desc; + if (!usb_endpoint_is_int_in(endpoint)) + return -ENODEV; + kbtab = kzalloc(sizeof(struct kbtab), GFP_KERNEL); input_dev = input_allocate_device(); if (!kbtab || !input_dev) @@ -163,8 +167,6 @@ static int kbtab_probe(struct usb_interface *intf, const struct usb_device_id *i input_set_abs_params(input_dev, ABS_Y, 0, 0x1750, 4, 0); input_set_abs_params(input_dev, ABS_PRESSURE, 0, 0xff, 0, 0); - endpoint = &intf->cur_altsetting->endpoint[0].desc; - usb_fill_int_urb(kbtab->irq, dev, usb_rcvintpipe(dev, endpoint->bEndpointAddress), kbtab->data, 8, -- 2.20.1