Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp5342832yba; Mon, 13 May 2019 09:15:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqyA+R4tUD6DmF6Eyw/TZjK0qmPb10H4cpGrcXniRVRrw7La8tbd3ysWwL8fTp9uBqjQz3X2 X-Received: by 2002:a63:ba5a:: with SMTP id l26mr32218152pgu.183.1557764113118; Mon, 13 May 2019 09:15:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557764113; cv=none; d=google.com; s=arc-20160816; b=VBtiR7Hc085WuyCCYpi+MJ9RU//81nDfpoWCFqp9KW8nGUzn7SI6fIgU0fqxdN22Nv KOAfdGfrd7uorYLrf2JotW1f6dSRTCLnDCs7iAfgSL+P8oPt3MpA+8ikfrLr/Jc9Vp0f JgjzdrfBpQAkHW2y1QSTbV/cI9piVGCFWC3szYbYdlsJ2u84ykgi/nhfGFuwIdgFYy1K deVBlSOI1dpo0u6WNWaMpvxmYEc9t6W8wD2o+wqXQyjRyAGdQ9aU9pbAfNkMBU9Rasmv hnYv7OXJt/yhf03Qi8Jl73ZMZ/fB5uZZGakzhHM6S2FrV+dlZbS9jC99+inPuru47XG2 MZ7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:in-reply-to :subject:cc:to:from:date; bh=Wrp29BwABV8cXcCnics1ld1FuXJjW93TwSbv1qdNlH8=; b=OhLVnPK/VznaSHyJSfA8dhIIEXH7WiydHioP8z0qDkgcnwVitvELzQ8GZ3wOky1bCU XBHjrJqup3FnRYKpgeg4qHHHp5tv/TdyM7QAl7sq31I38sOgV+b9NB+QWkTGFWyF9eCx /g6RfCc5zOfe7P4HokNfIVz1I05aPWV5My7WdvIXu4r1avgCzeMwx042yyigMlwnDr1N sknD+pifuFbf7+Y1EfnW5INsm8KINvt+nIR9yT+1uJ81JodGbYf3kcKb+QEb0PUenXcV iyYn2OHbWXiR3Ybeuo+bnLmACTCKkcTwd7JAM3vaZ4FG5ssDtmqiMA0IOOJaekIIVqi1 1Png== ARC-Authentication-Results: i=1; mx.google.com; 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 q33si3344529pgm.287.2019.05.13.09.14.56; Mon, 13 May 2019 09:15:13 -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; 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 S1730855AbfEMOrg (ORCPT + 99 others); Mon, 13 May 2019 10:47:36 -0400 Received: from iolanthe.rowland.org ([192.131.102.54]:53580 "HELO iolanthe.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1728916AbfEMOrf (ORCPT ); Mon, 13 May 2019 10:47:35 -0400 Received: (qmail 3884 invoked by uid 2102); 13 May 2019 10:47:34 -0400 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 13 May 2019 10:47:34 -0400 Date: Mon, 13 May 2019 10:47:34 -0400 (EDT) From: Alan Stern X-X-Sender: stern@iolanthe.rowland.org To: syzbot cc: andreyknvl@google.com, , , , , , Subject: Re: KASAN: slab-out-of-bounds Write in usb_get_bos_descriptor In-Reply-To: <00000000000086510e05888df8c8@google.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 10 May 2019, syzbot wrote: > Hello, > > syzbot found the following crash on: > > HEAD commit: 43151d6c usb-fuzzer: main usb gadget fuzzer driver > git tree: https://github.com/google/kasan.git usb-fuzzer > console output: https://syzkaller.appspot.com/x/log.txt?x=124794d8a00000 > kernel config: https://syzkaller.appspot.com/x/.config?x=4183eeef650d1234 > dashboard link: https://syzkaller.appspot.com/bug?extid=71f1e64501a309fcc012 > compiler: gcc (GCC) 9.0.0 20181231 (experimental) > syz repro: https://syzkaller.appspot.com/x/repro.syz?x=176a53d0a00000 > > IMPORTANT: if you fix the bug, please add the following tag to the commit: > Reported-by: syzbot+71f1e64501a309fcc012@syzkaller.appspotmail.com > > usb 1-1: Using ep0 maxpacket: 8 > ================================================================== > BUG: KASAN: slab-out-of-bounds in usb_get_bos_descriptor+0x8be/0x8fb > drivers/usb/core/config.c:976 > Write of size 1 at addr ffff8880a48e38ec by task kworker/0:2/533 Insufficient descriptor size check. Alan Stern #syz test: https://github.com/google/kasan.git usb-fuzzer drivers/usb/core/config.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) Index: usb-devel/drivers/usb/core/config.c =================================================================== --- usb-devel.orig/drivers/usb/core/config.c +++ usb-devel/drivers/usb/core/config.c @@ -932,8 +932,8 @@ int usb_get_bos_descriptor(struct usb_de /* Get BOS descriptor */ ret = usb_get_descriptor(dev, USB_DT_BOS, 0, bos, USB_DT_BOS_SIZE); - if (ret < USB_DT_BOS_SIZE) { - dev_err(ddev, "unable to get BOS descriptor\n"); + if (ret < USB_DT_BOS_SIZE || bos->bLength < USB_DT_BOS_SIZE) { + dev_err(ddev, "unable to get BOS descriptor or descriptor too short\n"); if (ret >= 0) ret = -ENOMSG; kfree(bos);