[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEkJfYPAvVbN5qzAWZchaF25WehCWU4FEYH8VJBkBadLgY-rFQ@mail.gmail.com>
Date: Fri, 8 Mar 2024 10:48:07 +0800
From: Sam Sun <samsun1006219@...il.com>
To: Alan Stern <stern@...land.harvard.edu>
Cc: linux-kernel@...r.kernel.org, linux-usb@...r.kernel.org,
"xrivendell7@...il.com" <xrivendell7@...il.com>, Greg KH <gregkh@...uxfoundation.org>,
hgajjar@...adit-jv.com, quic_ugoswami@...cinc.com, stanley_chang@...ltek.com,
heikki.krogerus@...ux.intel.com
Subject: Re: [Bug] INFO: task hung in hub_activate
On Fri, Mar 8, 2024 at 4:35 AM Alan Stern <stern@...land.harvard.edu> wrote:
>
> On Mon, Mar 04, 2024 at 08:10:02PM +0800, Sam Sun wrote:
> > Dear developers and maintainers,
> >
> > We encountered a task hung in function hub_activate(). It was reported
> > before by Syzbot several years ago
> > (https://groups.google.com/g/syzkaller-lts-bugs/c/_komEgHj03Y/m/rbcVKyLXBwAJ),
> > but no repro at that time. We have a C repro this time and kernel
> > config is attached to this email. The bug report is listed below.
>
> > If you have any questions, please contact us.
> >
> > Reported by Yue Sun <samsun1006219@...il.com>
> > Reported by xingwei lee <xrivendell7@...il.com>
>
> Yue:
>
> Can you try testing the patch below? Thanks.
>
> Alan Stern
>
>
>
> Index: usb-devel/drivers/usb/core/sysfs.c
> ===================================================================
> --- usb-devel.orig/drivers/usb/core/sysfs.c
> +++ usb-devel/drivers/usb/core/sysfs.c
> @@ -1168,14 +1168,24 @@ static ssize_t interface_authorized_stor
> {
> struct usb_interface *intf = to_usb_interface(dev);
> bool val;
> + struct kernfs_node *kn;
>
> if (kstrtobool(buf, &val) != 0)
> return -EINVAL;
>
> - if (val)
> + if (val) {
> usb_authorize_interface(intf);
> - else
> - usb_deauthorize_interface(intf);
> + } else {
> + /*
> + * Prevent deadlock if another process is concurrently
> + * trying to unregister intf or its parent device.
> + */
> + kn = sysfs_break_active_protection(&dev->kobj, &attr->attr);
> + if (kn) {
> + usb_deauthorize_interface(intf);
> + sysfs_unbreak_active_protection(kn);
> + }
> + }
>
> return count;
> }
Hi Alan,
I applied this patch on the latest linux git commit and tested several
times. There is no more task hung report, so I think it works. Should
I try this on usb-dev branch?
Best,
Yue
Powered by blists - more mailing lists