usb: gadget: u_serial: add missing port entry locking
Greg Kroah-Hartman
maintainerPATCH 1/5 usb: gadget: u_serial: add missing port entry locking
Quoted 13 lines · Michał Mirosław
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 <[email protected]>--- drivers/usb/gadget/function/u_serial.c | 2 ++ 1 file changed, 2 insertions(+)drivers/usb/gadget/function/u_serial.c +0
-0
drivers/usb/gadget/function/u_serial.c int gserial_alloc_line(unsigned char *line_num) · line 1248
Quoted 10 lines
drivers/usb/gadget/function/u_serial.c +2
-0@@ -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; }
Should this be backported to stable kernels to resolve this issue?
thanks,
greg k-h