mirror of
https://github.com/nxp-imx/linux-imx.git
synced 2026-06-25 11:43:20 +02:00
USB: serial: io_edgeport: fix possible sleep-in-atomic
commitc7b8f77872upstream. According to drivers/usb/serial/io_edgeport.c, the driver may sleep under a spinlock. The function call path is: edge_bulk_in_callback (acquire the spinlock) process_rcvd_data process_rcvd_status change_port_settings send_iosp_ext_cmd write_cmd_usb usb_kill_urb --> may sleep To fix it, the redundant usb_kill_urb() is removed from the error path after usb_submit_urb() fails. This possible bug is found by my static analysis tool (DSAC) and checked by my code review. Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com> Fixes:1da177e4c3("Linux-2.6.12-rc2") Signed-off-by: Johan Hovold <johan@kernel.org> [bwh: Backported to 3.2: adjust context] Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
This commit is contained in:
parent
948e5ebd9b
commit
c2ddb5852a
|
|
@ -2387,7 +2387,6 @@ static int write_cmd_usb(struct edgeport_port *edge_port,
|
||||||
dev_err(&edge_port->port->dev,
|
dev_err(&edge_port->port->dev,
|
||||||
"%s - usb_submit_urb(write command) failed, status = %d\n",
|
"%s - usb_submit_urb(write command) failed, status = %d\n",
|
||||||
__func__, status);
|
__func__, status);
|
||||||
usb_kill_urb(urb);
|
|
||||||
usb_free_urb(urb);
|
usb_free_urb(urb);
|
||||||
atomic_dec(&CmdUrbs);
|
atomic_dec(&CmdUrbs);
|
||||||
return status;
|
return status;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user