All of lore.kernel.org
 help / color / mirror / Atom feed
* [v3,1/5] usb: gadget: u_serial: add missing port entry locking
@ 2019-02-27 10:46 Michał Mirosław
  0 siblings, 0 replies; 2+ messages in thread
From: Michał Mirosław @ 2019-02-27 10:46 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.

Cc: stable@vger.kernel.org
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
  v3: added cc-stable
  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

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

On Wed, Feb 27, 2019 at 11:46:57AM +0100, Michał Mirosław wrote:
> gserial_alloc_line() misses locking (for a release barrier) while
> resetting port entry on TTY allocation failure. Fix this.
> 
> Cc: stable@vger.kernel.org
> Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
> 

Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

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

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-27 10:46 [v3,1/5] usb: gadget: u_serial: add missing port entry locking Michał Mirosław
2019-02-27 13:03 Greg Kroah-Hartman

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.