All of lore.kernel.org
 help / color / mirror / Atom feed
* [v2,1/5] usb: gadget: u_serial: add missing port entry locking
@ 2019-02-27  9:29 Michał Mirosław
  0 siblings, 0 replies; 2+ messages in thread
From: Michał Mirosław @ 2019-02-27  9:29 UTC (permalink / raw)
  To: linux-usb; +Cc: Felipe Balbi, Greg Kroah-Hartman

gserial_alloc_line() misses locking (for a release barrier) while
resetting port entry on TTY allocation failure. Fix this.

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
  v2: no changes
---
 drivers/usb/gadget/function/u_serial.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/usb/gadget/function/u_serial.c b/drivers/usb/gadget/function/u_serial.c
index 65f634ec7fc2..bb1e2e1d0076 100644
--- a/drivers/usb/gadget/function/u_serial.c
+++ b/drivers/usb/gadget/function/u_serial.c
@@ -1239,8 +1239,10 @@ int gserial_alloc_line(unsigned char *line_num)
 				__func__, port_num, PTR_ERR(tty_dev));
 
 		ret = PTR_ERR(tty_dev);
+		mutex_lock(&ports[port_num].lock);
 		port = ports[port_num].port;
 		ports[port_num].port = NULL;
+		mutex_unlock(&ports[port_num].lock);
 		gserial_free_port(port);
 		goto err;
 	}

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [v2,1/5] usb: gadget: u_serial: add missing port entry locking
@ 2019-02-27  9:34 Greg Kroah-Hartman
  0 siblings, 0 replies; 2+ messages in thread
From: Greg Kroah-Hartman @ 2019-02-27  9:34 UTC (permalink / raw)
  To: Michał Mirosław; +Cc: linux-usb, Felipe Balbi

On Wed, Feb 27, 2019 at 10:29:37AM +0100, Michał Mirosław wrote:
> gserial_alloc_line() misses locking (for a release barrier) while
> resetting port entry on TTY allocation failure. Fix this.
> 
> Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
> ---
>   v2: no changes

Shouldn't you have added a:
Cc: stable <stable@vger.kernel.org>

to this?  :)

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-02-27  9:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-27  9:34 [v2,1/5] usb: gadget: u_serial: add missing port entry locking Greg Kroah-Hartman
  -- strict thread matches above, loose matches on Subject: below --
2019-02-27  9:29 Michał Mirosław

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.