[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20191211150223.060339802@linuxfoundation.org>
Date: Wed, 11 Dec 2019 16:04:56 +0100
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org,
Michał Mirosław <mirq-linux@...e.qmqm.pl>,
Ladislav Michl <ladis@...ux-mips.org>,
Felipe Balbi <felipe.balbi@...ux.intel.com>
Subject: [PATCH 5.3 007/105] usb: gadget: u_serial: add missing port entry locking
From: Michał Mirosław <mirq-linux@...e.qmqm.pl>
commit daf82bd24e308c5a83758047aff1bd81edda4f11 upstream.
gserial_alloc_line() misses locking (for a release barrier) while
resetting port entry on TTY allocation failure. Fix this.
Cc: stable@...r.kernel.org
Signed-off-by: Michał Mirosław <mirq-linux@...e.qmqm.pl>
Reviewed-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Tested-by: Ladislav Michl <ladis@...ux-mips.org>
Signed-off-by: Felipe Balbi <felipe.balbi@...ux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
drivers/usb/gadget/function/u_serial.c | 2 ++
1 file changed, 2 insertions(+)
--- 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 *li
__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;
}
Powered by blists - more mailing lists