Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1534641ybl; Thu, 22 Aug 2019 16:36:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqzYDUxWM+EdfVtW8rnhDmzYrAcmXJl1g5UwASGfyklxdmgas6s1qyyQ9pWr/JJBoIvD8C5x X-Received: by 2002:a63:2a08:: with SMTP id q8mr1406954pgq.415.1566517016369; Thu, 22 Aug 2019 16:36:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566517016; cv=none; d=google.com; s=arc-20160816; b=LCXxwhK10NHlqEWSIUiRCXEW1SiTPfdLf06SGQmkLUJXoCJXSHL/JHn8IDqp+V5HMz n0XuXnPfRBjlUFQ4T9kapr92kKKr6l4R/SjvDT0W+YWjOOtd5HK4rQ3EUIKy/bDQyW6Q +2Xjuj34D1I+SF3QhKj4YdOEaufM10L9R1UsxqfI+OPIpXJbtoNHtAKwxGbLkBeT3D3D golFvxAB6PBF0HdBN2n+iI3kaW83gtCHRpV8n9Iz9nfcn+iVaLH7izBccJZXj8Vj96i7 eNEmYErCS9Rk/wGni3Rkq77/x0LPAQSYaIxwP5tYlB9WG0GkWfTa+Gp4fdhZ3R9dk6jV DXbw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ZaMvY4hxFlGVYDhj2nDG4bEh0mk822krkt04Zkraer8=; b=BUz7x51+YSRbU6Aj+FW5upm+3EBPEcjAJHlRspNwDF4rRq3eKjMCAA99WYEDyO/p+Q AXfsEO2Pk45guqKFMWFu+elgV1ZgUGPFJQp6/ytd2FiJIcIaj2SxAzlwXm7pLjXs9nej SZ3hINv1Ba997k5BxzPSJZCZlMdogml6Ic+xKJ+6DMP0uAWnQayQb/AxFhCJTsJ1Ir9X 2FIVFNQdjUWCQ/5OpUugzyik/nkkOv3QyNeS1paREfaRjmzVPNcgsg/PobxMNIfgnYvI wvjS0qD4adJ6Np2oZaz0IT0s8qc9UJEqO2Dk6ygvw2u31/rzd5BgDWJ90hpsMBCh1aTH qNbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=de1DPJS1; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id cj2si870317plb.190.2019.08.22.16.36.35; Thu, 22 Aug 2019 16:36:56 -0700 (PDT) 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=de1DPJS1; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732853AbfHVRRP (ORCPT + 99 others); Thu, 22 Aug 2019 13:17:15 -0400 Received: from mail.kernel.org ([198.145.29.99]:58088 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390350AbfHVRI3 (ORCPT ); Thu, 22 Aug 2019 13:08:29 -0400 Received: from sasha-vm.mshome.net (wsip-184-188-36-2.sd.sd.cox.net [184.188.36.2]) (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 DA2D823405; Thu, 22 Aug 2019 17:08:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1566493709; bh=NC7ztbCd7aVI48pb50ZBHxNerlptjjT/MMMS582ur3I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=de1DPJS1kaxByP25xauYMsMFJNQPdz5PrZ3JVbFAx31xfY/Wkla7c8m7ssxU6LgBP uFfU8gKtq0AS8BP7jvzZPagPLBJIAQrhjLIXXpqBMD0ENB+RWGfjN85Ak2iBmyfvY9 khOKNLi5ghonq1JZN50QPaklW9657GWPeOxHjnCQ= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Oliver Neukum , syzbot+c7df50363aaff50aa363@syzkaller.appspotmail.com, Dmitry Torokhov , Greg Kroah-Hartman Subject: [PATCH 5.2 027/135] Input: kbtab - sanity check for endpoint type Date: Thu, 22 Aug 2019 13:06:23 -0400 Message-Id: <20190822170811.13303-28-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190822170811.13303-1-sashal@kernel.org> References: <20190822170811.13303-1-sashal@kernel.org> MIME-Version: 1.0 X-KernelTest-Patch: http://kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.2.10-rc1.gz X-KernelTest-Tree: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git X-KernelTest-Branch: linux-5.2.y X-KernelTest-Patches: git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git X-KernelTest-Version: 5.2.10-rc1 X-KernelTest-Deadline: 2019-08-24T17:07+00:00 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 commit c88090dfc84254fa149174eb3e6a8458de1912c4 upstream. 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: Greg Kroah-Hartman --- 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 04b85571f41e3..aa577898e952b 100644 --- a/drivers/input/tablet/kbtab.c +++ b/drivers/input/tablet/kbtab.c @@ -117,6 +117,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) @@ -155,8 +159,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