All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sam Sun <samsun1006219@gmail.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org,
	 "xrivendell7@gmail.com" <xrivendell7@gmail.com>,
	Greg KH <gregkh@linuxfoundation.org>,
	 hgajjar@de.adit-jv.com, quic_ugoswami@quicinc.com,
	stanley_chang@realtek.com,  heikki.krogerus@linux.intel.com
Subject: Re: [Bug] INFO: task hung in hub_activate
Date: Fri, 8 Mar 2024 10:48:07 +0800	[thread overview]
Message-ID: <CAEkJfYPAvVbN5qzAWZchaF25WehCWU4FEYH8VJBkBadLgY-rFQ@mail.gmail.com> (raw)
In-Reply-To: <0afd0885-1650-47db-b2b3-43b597352e6b@rowland.harvard.edu>

On Fri, Mar 8, 2024 at 4:35 AM Alan Stern <stern@rowland.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@gmail.com>
> > Reported by xingwei lee <xrivendell7@gmail.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

      reply	other threads:[~2024-03-08  2:48 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-04 12:10 [Bug] INFO: task hung in hub_activate Sam Sun
2024-03-04 13:37 ` Hillf Danton
2024-03-04 14:59 ` Alan Stern
2024-03-04 16:15 ` Alan Stern
2024-03-04 16:36   ` Greg KH
2024-03-04 18:30     ` Alan Stern
2024-03-04 19:17       ` Bug in sysfs_break_active_protection() Alan Stern
2024-03-13 20:21         ` Tejun Heo
2024-03-13 21:43           ` [PATCH] fs: sysfs: Fix reference leak " Alan Stern
2024-03-13 21:44             ` Tejun Heo
2024-03-13 22:10             ` Bart Van Assche
2024-03-05 12:03       ` [Bug] INFO: task hung in hub_activate Greg KH
2024-03-07 20:35 ` Alan Stern
2024-03-08  2:48   ` Sam Sun [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAEkJfYPAvVbN5qzAWZchaF25WehCWU4FEYH8VJBkBadLgY-rFQ@mail.gmail.com \
    --to=samsun1006219@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=hgajjar@de.adit-jv.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=quic_ugoswami@quicinc.com \
    --cc=stanley_chang@realtek.com \
    --cc=stern@rowland.harvard.edu \
    --cc=xrivendell7@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.