Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1374306

Re: [PATCHv2] usb: f_mass_storage: test whether thread is running before starting another

From Alan Stern <stern@rowland.harvard.edu>
Newsgroups linux.kernel
Subject Re: [PATCHv2] usb: f_mass_storage: test whether thread is running before starting another
Date 2016-04-08 17:30 +0200
Message-ID <rlGwa-5UD-17@gated-at.bofh.it> (permalink)
References <rlzXI-XP-23@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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>

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCHv2] usb: f_mass_storage: test whether thread is running before starting another Michal Nazarewicz <mina86@mina86.com> - 2016-04-08 10:30 +0200
  Re: [PATCHv2] usb: f_mass_storage: test whether thread is running  before starting another Alan Stern <stern@rowland.harvard.edu> - 2016-04-08 17:30 +0200

csiph-web