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 64196C7618B for ; Fri, 26 Jul 2019 13:54:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3943822CE5 for ; Fri, 26 Jul 2019 13:54:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564149257; bh=e7TlCX8CgBSZQJbsi2Wd8yPoI5pJ7ssrd7Cq5zvGGHE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=Kni42G06s91zabE8OMS2dKC/lZ4aljqU4FfGCSjys/fwl9OETh54IzVMAvTmv26+m IJaewIcM/6ZUtDOlvMmd2nH6wm1Q4mqiNyByiXGCltul0EvKdfVolVX/Gf4zVRYNF8 pZuEL/IyWwWAyZvIVzFg1abxHjqxEf6TH98RSSBo= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388047AbfGZNmz (ORCPT ); Fri, 26 Jul 2019 09:42:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:50252 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388064AbfGZNmx (ORCPT ); Fri, 26 Jul 2019 09:42:53 -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 0020E22BF5; Fri, 26 Jul 2019 13:42:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564148572; bh=e7TlCX8CgBSZQJbsi2Wd8yPoI5pJ7ssrd7Cq5zvGGHE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pJLV7I8lttBRwM3ge5H7Bu0n21m1eT76d3zJ9kQt8IMQ9dug9q2q/uATqzQoCNmxA kO1+72XfMTJ0Jvpsf2utng9EsX3U9RJKU8/ICT4K8BbWOzG3hBXeo7pfxrnSm+/JFf Ms1ODnJHiVZxSRJ5WcXwdKdiMUCC9kpOLxYVYdiI= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Phong Tran , syzbot+8750abbc3a46ef47d509@syzkaller.appspotmail.com, "David S . Miller" , Sasha Levin , netdev@vger.kernel.org Subject: [PATCH AUTOSEL 4.19 26/47] ISDN: hfcsusb: checking idx of ep configuration Date: Fri, 26 Jul 2019 09:41:49 -0400 Message-Id: <20190726134210.12156-26-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190726134210.12156-1-sashal@kernel.org> References: <20190726134210.12156-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Phong Tran [ Upstream commit f384e62a82ba5d85408405fdd6aeff89354deaa9 ] The syzbot test with random endpoint address which made the idx is overflow in the table of endpoint configuations. this adds the checking for fixing the error report from syzbot KASAN: stack-out-of-bounds Read in hfcsusb_probe [1] The patch tested by syzbot [2] Reported-by: syzbot+8750abbc3a46ef47d509@syzkaller.appspotmail.com [1]: https://syzkaller.appspot.com/bug?id=30a04378dac680c5d521304a00a86156bb913522 [2]: https://groups.google.com/d/msg/syzkaller-bugs/_6HBdge8F3E/OJn7wVNpBAAJ Signed-off-by: Phong Tran Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/isdn/hardware/mISDN/hfcsusb.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/isdn/hardware/mISDN/hfcsusb.c b/drivers/isdn/hardware/mISDN/hfcsusb.c index 6d05946b445e..060dc7fd66c1 100644 --- a/drivers/isdn/hardware/mISDN/hfcsusb.c +++ b/drivers/isdn/hardware/mISDN/hfcsusb.c @@ -1967,6 +1967,9 @@ hfcsusb_probe(struct usb_interface *intf, const struct usb_device_id *id) /* get endpoint base */ idx = ((ep_addr & 0x7f) - 1) * 2; + if (idx > 15) + return -EIO; + if (ep_addr & 0x80) idx++; attr = ep->desc.bmAttributes; -- 2.20.1