提交 daf82bd2 编写于 作者: M Michał Mirosław 提交者: Felipe Balbi

usb: gadget: u_serial: add missing port entry locking

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: NMichał Mirosław <mirq-linux@rere.qmqm.pl>
Reviewed-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tested-by: NLadislav Michl <ladis@linux-mips.org>
Signed-off-by: NFelipe Balbi <felipe.balbi@linux.intel.com>
上级 9ba3aca8
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册