Skip to contentSkip to conversation

usb/io_edgeport: Fix a possible sleep-in-atomic bug in edge_bulk_in_callback

DISCUSSION Johan Hovold 1 participant 1 message Dec 14, 2017 USB

lore
Share & tools
lore
#0 lore raw
Quoted 5 lines · Jia-Ju Bai

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

Quoted 7 lines
     process_rcvd_status
       change_port_settings
         send_iosp_ext_cmd
           write_cmd_usb
             usb_kill_urb --> may sleep

To fix it, usb_kill_urb() is removed from the error path after usb_submit_urb() fails.

I added a "the redundant" before "usb_kill_urb()" in the above sentence to make it more clear why this was done.

Quoted 1 line

This possible bug is found by my static analysis tool (DSAC) and checked by my code review.

And line-wrapped you commit message (at about 72 columns).

I also used a common prefix and shortened the summary to:

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

Just some minor nits, that you can keep in mind for your next patch submission.

Quoted 1 line

Thanks for reporting and fixing this. Now applied for -next.

Johan
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html