Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c7b8f778 authored by Jia-Ju Bai's avatar Jia-Ju Bai Committed by Johan Hovold
Browse files

USB: serial: io_edgeport: fix possible sleep-in-atomic



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: default avatarJia-Ju Bai <baijiaju1990@gmail.com>
Fixes: 1da177e4 ("Linux-2.6.12-rc2")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
parent d8a42b1f
Loading
Loading
Loading
Loading
+0 −1
Original line number Original line Diff line number Diff line
@@ -2282,7 +2282,6 @@ static int write_cmd_usb(struct edgeport_port *edge_port,
		/* something went wrong */
		/* something went wrong */
		dev_err(dev, "%s - usb_submit_urb(write command) failed, status = %d\n",
		dev_err(dev, "%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;