All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alan Stern <stern@rowland.harvard.edu>
To: Michal Nazarewicz <mina86@mina86.com>
Cc: Felipe Balbi <felipe.balbi@linux.intel.com>,
	<linux-usb@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>,
	<stable@vger.kernel.org>
Subject: Re: [PATCHv2] usb: f_mass_storage: test whether thread is running before starting another
Date: Fri, 8 Apr 2016 11:19:45 -0400 (EDT)	[thread overview]
Message-ID: <Pine.LNX.4.44L0.1604081119260.2069-100000@iolanthe.rowland.org> (raw)
In-Reply-To: <1460103851-16102-1-git-send-email-mina86@mina86.com>

On Fri, 8 Apr 2016, Michal Nazarewicz wrote:

> When binding the function to usb_configuration, check whether the thread
> is running before starting another one.  Without that, when function
> instance is added to multiple configurations, fsg_bing starts multiple
> threads with all but the latest one being forgotten by the driver.  This
> leads to obvious thread leaks, possible lockups when trying to halt the
> machine and possible more issues.
> 
> This fixes issues with legacy/multi¹ gadget as well as configfs gadgets
> when mass_storage function is added to multiple configurations.
> 
> This change also simplifies API since the legacy gadgets no longer need
> to worry about starting the thread by themselves (which was where bug
> in legacy/multi was in the first place).
> 
> N.B., this patch doesn’t address adding single mass_storage function
> instance to a single configuration twice.  Thankfully, there’s no
> legitimate reason for such setup plus, if I’m not mistaken, configfs
> gadget doesn’t even allow it to be expressed.
> 
> ¹ I have no example failure though.  Conclusion that legacy/multi has
>   a bug is based purely on me reading the code.
> 
> Signed-off-by: Michal Nazarewicz <mina86@mina86.com>
> Tested-by: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>
> Cc: Alan Stern <stern@rowland.harvard.edu>
> Cc: stable@vger.kernel.org

Acked-by: Alan Stern <stern@rowland.harvard.edu>

      reply	other threads:[~2016-04-08 15:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-08  8:24 [PATCHv2] usb: f_mass_storage: test whether thread is running before starting another Michal Nazarewicz
2016-04-08  8:27 ` Michal Nazarewicz
2016-04-08 15:19 ` Alan Stern [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=Pine.LNX.4.44L0.1604081119260.2069-100000@iolanthe.rowland.org \
    --to=stern@rowland.harvard.edu \
    --cc=felipe.balbi@linux.intel.com \
    --cc=ivo.g.dimitrov.75@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mina86@mina86.com \
    --cc=stable@vger.kernel.org \
    /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.