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=ham 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 3B9BBC7618B for ; Fri, 26 Jul 2019 13:44:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 06CB222CD0 for ; Fri, 26 Jul 2019 13:44:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564148643; bh=f8DpPcbs0QW/h62qopKrOqchVsN4j5wUb77ZcIc2rUI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=iMAJ7eEl4EeqXj8J8NUJW6Cj0Y1Zb58EGP7wSqrUEeQvevQYhrNRDKC1sedK5zOvf GpMIbi1m8spnrwdKFG1argRmH+ZDOfuyXy/rKs0HR5yzWE+SzVQm7kXRpCcYETaSSI rffleXULpX/t7qLGF+z6iclijDGKhuZl8d1NrqXk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387834AbfGZNoB (ORCPT ); Fri, 26 Jul 2019 09:44:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:51968 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727913AbfGZNn7 (ORCPT ); Fri, 26 Jul 2019 09:43:59 -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 ECD5522CC0; Fri, 26 Jul 2019 13:43:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564148638; bh=f8DpPcbs0QW/h62qopKrOqchVsN4j5wUb77ZcIc2rUI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y5nxlgXoJ3R4kFD4Op1YO3cYiOmbVCeo3q/8iaexittEzsl2UExTbhI4OvLyy1WH8 cn1BIxuYtbWM/5+50+wCXoHfS6CzdeywZ0mTCiU7b4H+/0vW12T686IXg3dOnrEGJ8 gpRRE4YOne3a2fPStN5oj5sivu0nyIDa762DeqVQ= 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.14 19/37] ISDN: hfcsusb: checking idx of ep configuration Date: Fri, 26 Jul 2019 09:43:14 -0400 Message-Id: <20190726134332.12626-19-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190726134332.12626-1-sashal@kernel.org> References: <20190726134332.12626-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: 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 17cc879ad2bb..35983c7c3137 100644 --- a/drivers/isdn/hardware/mISDN/hfcsusb.c +++ b/drivers/isdn/hardware/mISDN/hfcsusb.c @@ -1963,6 +1963,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