Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp3100339pxv; Mon, 12 Jul 2021 09:16:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxQyM6GtyqLdYKT2TlossNKxD9xx7pWuxN9MbQoFBjtc4UJI5xqllkFIMO/LXPgedO50DUp X-Received: by 2002:a05:6e02:2187:: with SMTP id j7mr13265747ila.227.1626106604799; Mon, 12 Jul 2021 09:16:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626106604; cv=none; d=google.com; s=arc-20160816; b=a5P0kJgDI4caGx+x+WGdFu6XQkO56ezrBHc7AbwnQbuid9VUTMPItkNonYFuOKwQXK Sntm6vEvQ2HukTw/grE9d0fZnwGAx6W9JDxSblnsGIOB+Fgs3ZJOS4fZhqttfg8HCmir D0GEswjjO8FCYaVZtYmfa+1C9Nc8M1BIwHYrLnV1AUKpPKP2aGstEGrpYAjR/ii6cG7y GnuLvrg2dfRv6MmkCG5EevhIgzBa2743ToEod1LNmg+49D176p/fbWI3ExfvwOtHv00r JqXXYkVmSNCzW084YFilKeX1BnXLB/fUzf/XsC9Zb0QmvJ9tg0t1CLb73s8LpT7aLjrU 8wYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=LEdn6ht9vKzkkBEcOi22hE81pStLo0vVF6a7whzBAqo=; b=A/9WIrTvkYtaCzsK2L36tL6UTUBO3yZFHluH8UnY5vwrKD+bQQmfDE4X+qNJSxx8aA EJefiR/nZvWSPJzj3JiOF7rcQbBG9saAHUBCby9OKwsfOtiBrNk6GItK64vH8jIwuaNr OTXqCfe9nKZDUJ9DzzHpDrCLY01nU79nDjLNE7uvdR+K8bd2mxnbEtv0vQ9uID4LUrDk JEse7zcQJiJplFRaaIvgOd7wsNLDECqeUpn3FCUYbaFN+KT8aVXeLk3L8ImEiB+AMktD E1u4rPLV5IH2sYC8+zxWnjtuEw9YI57gEGxCnKkyaVsGpTWKWKrOcn5vq8k211VoVxZZ ad2g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n6si18258983ilj.66.2021.07.12.09.16.31; Mon, 12 Jul 2021 09:16:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231651AbhGLQRf (ORCPT + 99 others); Mon, 12 Jul 2021 12:17:35 -0400 Received: from netrider.rowland.org ([192.131.102.5]:50365 "HELO netrider.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S230019AbhGLQRe (ORCPT ); Mon, 12 Jul 2021 12:17:34 -0400 Received: (qmail 321950 invoked by uid 1000); 12 Jul 2021 12:14:45 -0400 Date: Mon, 12 Jul 2021 12:14:45 -0400 From: Alan Stern To: Johan Hovold Cc: syzbot , gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, mathias.nyman@linux.intel.com, syzkaller-bugs@googlegroups.com Subject: Re: [syzbot] WARNING in do_proc_control/usb_submit_urb Message-ID: <20210712161445.GA321728@rowland.harvard.edu> References: <20210711155345.GB293743@rowland.harvard.edu> <00000000000068b24405c6db3249@google.com> <20210712140004.GA316776@rowland.harvard.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 12, 2021 at 05:50:41PM +0200, Johan Hovold wrote: > On Mon, Jul 12, 2021 at 05:29:20PM +0200, Johan Hovold wrote: > > On Mon, Jul 12, 2021 at 10:00:04AM -0400, Alan Stern wrote: > > > On Sun, Jul 11, 2021 at 09:07:09AM -0700, syzbot wrote: > > > > Hello, > > > > > > > > syzbot has tested the proposed patch but the reproducer is still triggering an issue: > > > > WARNING in do_proc_control/usb_submit_urb > > > > I don't get this. It shouldn't be possible. The fact that the > > > direction bit is set in both bRequestType and pipe means that the URB > > > was submitted as a control-IN but had length 0. But the patch addresses > > > exactly that case: > > > > > > --- usb-devel.orig/drivers/usb/core/devio.c > > > +++ usb-devel/drivers/usb/core/devio.c > > > @@ -1133,7 +1133,7 @@ static int do_proc_control(struct usb_de > > > "wIndex=%04x wLength=%04x\n", > > > ctrl->bRequestType, ctrl->bRequest, ctrl->wValue, > > > ctrl->wIndex, ctrl->wLength); > > > - if (ctrl->bRequestType & 0x80) { > > > + if ((ctrl->bRequestType & USB_DIR_IN) && ctrl->wLength) { > > > pipe = usb_rcvctrlpipe(dev, 0); > > > snoop_urb(dev, NULL, pipe, ctrl->wLength, tmo, SUBMIT, NULL, 0); > > > > > > and causes the kernel to handle it as a control-OUT instead. > > > > > > Johan, any ideas? > > > > Did syzbot actually test the patch? I can't see how the direction bit of > > the pipe argument can be set with the above applied either. > > It looks like the second patch you submitted was hand-edited and still > quoted. > > And looking at the dashboard it seems like no patch was applied for your > second test attempt: > > https://syzkaller.appspot.com/bug?extid=72af3105289dcb4c055b Yes, that explains it. Funny how easy it is to miss those "> " markings -- you just get too used to them. > I've been bitten by something like this before when erroneously thinking > that a test command could be submitted as a reply to a patch. > > Perhaps the report mail could include the patch tested or something so > we don't spend time investigating syzbot interface failures. Good idea. Anyway, here's the patch again, this time properly formatted. Hopefully now it will work. Alan Stern #syz test: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git ee268dee Index: usb-devel/drivers/usb/core/devio.c =================================================================== --- usb-devel.orig/drivers/usb/core/devio.c +++ usb-devel/drivers/usb/core/devio.c @@ -1133,7 +1133,7 @@ static int do_proc_control(struct usb_de "wIndex=%04x wLength=%04x\n", ctrl->bRequestType, ctrl->bRequest, ctrl->wValue, ctrl->wIndex, ctrl->wLength); - if (ctrl->bRequestType & 0x80) { + if ((ctrl->bRequestType & USB_DIR_IN) && ctrl->wLength) { pipe = usb_rcvctrlpipe(dev, 0); snoop_urb(dev, NULL, pipe, ctrl->wLength, tmo, SUBMIT, NULL, 0);