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=-13.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 E6D15C4338F for ; Fri, 13 Aug 2021 06:55:38 +0000 (UTC) Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9F81760C3E for ; Fri, 13 Aug 2021 06:55:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 9F81760C3E Authentication-Results: mail.kernel.org; dmarc=pass (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.linuxfoundation.org Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 7AD434043F; Fri, 13 Aug 2021 06:55:38 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id CwGAu4MjRW2O; Fri, 13 Aug 2021 06:55:34 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp4.osuosl.org (Postfix) with ESMTPS id 9D02C4035A; Fri, 13 Aug 2021 06:55:34 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 743ADC0010; Fri, 13 Aug 2021 06:55:34 +0000 (UTC) Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 864A0C000E for ; Fri, 13 Aug 2021 06:55:33 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 6948280D58 for ; Fri, 13 Aug 2021 06:55:33 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp1.osuosl.org (amavisd-new); dkim=pass (1024-bit key) header.d=linuxfoundation.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id KmZy7nqORq8X for ; Fri, 13 Aug 2021 06:55:28 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.8.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp1.osuosl.org (Postfix) with ESMTPS id ECD5880CAD for ; Fri, 13 Aug 2021 06:55:28 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id E034E60FC4; Fri, 13 Aug 2021 06:55:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1628837728; bh=wC9KO+fAlbgCYi+D5FKUGu8oWyySC3HH67pt+slS538=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Uu43ooe02x+C4gbtmWB0TUMYHwyDVgpIxqWCgWi1BTEulAEm2vwfkbLuXrDgDMf1T 8Nm2sHvVv72T6QjepCIYufEj60Lyp1ntjh2K0zkQAQpoixZHbioWTK1CNz1M8IJDgs IIUYXPZA30dr3/OqQZw1NeG1lC+JUF8ojbBu46go= Date: Fri, 13 Aug 2021 08:55:25 +0200 From: Greg Kroah-Hartman To: Anirudh Rayabharam Subject: Re: [PATCH] usbip: give back URBs for unsent unlink requests during cleanup Message-ID: References: <20210806164015.25263-1-mail@anirudhrb.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Cc: Shuah Khan , linux-usb@vger.kernel.org, Valentina Manea , linux-kernel@vger.kernel.org, syzbot+74d6ef051d3d2eacf428@syzkaller.appspotmail.com, linux-kernel-mentees@lists.linuxfoundation.org X-BeenThere: linux-kernel-mentees@lists.linuxfoundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-kernel-mentees-bounces@lists.linuxfoundation.org Sender: "Linux-kernel-mentees" On Fri, Aug 06, 2021 at 10:46:17PM +0530, Anirudh Rayabharam wrote: > On Fri, Aug 06, 2021 at 06:47:54PM +0200, Greg Kroah-Hartman wrote: > > On Fri, Aug 06, 2021 at 10:10:14PM +0530, Anirudh Rayabharam wrote: > > > In vhci_device_unlink_cleanup(), the URBs for unsent unlink requests are > > > not given back. This sometimes causes usb_kill_urb to wait indefinitely > > > for that urb to be given back. syzbot has reported a hung task issue [1] > > > for this. > > > > > > To fix this, give back the urbs corresponding to unsent unlink requests > > > (unlink_tx list) similar to how urbs corresponding to unanswered unlink > > > requests (unlink_rx list) are given back. Since the code is almost the > > > same, extract it into a new function and call it for both unlink_rx and > > > unlink_tx lists. > > > > > > [1]: https://syzkaller.appspot.com/bug?id=08f12df95ae7da69814e64eb5515d5a85ed06b76 > > > > > > Reported-by: syzbot+74d6ef051d3d2eacf428@syzkaller.appspotmail.com > > > Tested-by: syzbot+74d6ef051d3d2eacf428@syzkaller.appspotmail.com > > > Signed-off-by: Anirudh Rayabharam > > > --- > > > drivers/usb/usbip/vhci_hcd.c | 47 ++++++++++++++++++++++++++---------- > > > 1 file changed, 34 insertions(+), 13 deletions(-) > > > > > > diff --git a/drivers/usb/usbip/vhci_hcd.c b/drivers/usb/usbip/vhci_hcd.c > > > index 4ba6bcdaa8e9..45f98aa12895 100644 > > > --- a/drivers/usb/usbip/vhci_hcd.c > > > +++ b/drivers/usb/usbip/vhci_hcd.c > > > @@ -945,7 +945,8 @@ static int vhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status) > > > return 0; > > > } > > > > > > -static void vhci_device_unlink_cleanup(struct vhci_device *vdev) > > > +static void __vhci_cleanup_unlink_list(struct vhci_device *vdev, > > > + struct list_head *unlink_list) > > > { > > > struct vhci_hcd *vhci_hcd = vdev_to_vhci_hcd(vdev); > > > struct usb_hcd *hcd = vhci_hcd_to_hcd(vhci_hcd); > > > @@ -953,23 +954,25 @@ static void vhci_device_unlink_cleanup(struct vhci_device *vdev) > > > struct vhci_unlink *unlink, *tmp; > > > unsigned long flags; > > > > > > + if (unlink_list != &vdev->unlink_tx > > > + && unlink_list != &vdev->unlink_rx) { > > > + pr_err("Invalid list passed to __vhci_cleanup_unlink_list\n"); > > > + BUG(); > > > > Do not allow the system to crash, that is not ok. > > > > > + return; > > > > This call makes no sense as you just rebooted the machine :( > > > > Handle errors properly and recover from them and move on. A single tiny > > driver should not take down the whole system. > > The execution can reach only if there is a developer error and they passed > some random list in `unlink_list`. Why would a developer do that? As that is not the case in the kernel tree, no need to check for it. thanks, greg k-h _______________________________________________ Linux-kernel-mentees mailing list Linux-kernel-mentees@lists.linuxfoundation.org https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees