mbox series

[v4,0/2] usb: gadget: f_fs: Prevent race between functionfs_unbind & ffs_ep0_queue_wait

Message ID 20221215052906.8993-1-quic_ugoswami@quicinc.com (mailing list archive)
Headers show
Series usb: gadget: f_fs: Prevent race between functionfs_unbind & ffs_ep0_queue_wait | expand

Message

Udipto Goswami Dec. 15, 2022, 5:29 a.m. UTC
This series will prevent race between ep0_queue_wait &
functionfs_unbind. Currently, both routines are running
without any kind of serialization to make sure ep0req
doesn't get corrupted.

Changes in v4:
Split the implementation of v3 [1] into a series for better clarity.
Also, tested the patches by running USB plug-in/plug-out along with
composition switch.

Changes in v3:
Moved dequeue out of mutex to prevent deadlock.

Changes in v2:
Replaces spinlock with mutex & added dequeue operation in unbind.

[1]: https://patchwork.kernel.org/project/linux-usb/patch/20221125054119.25135-1-quic_ugoswami@quicinc.com/

Udipto Goswami (2):
  usb: gadget: f_fs: Prevent race during ffs_ep0_queue_wait
  usb: gadget: f_fs: Ensure ep0req is dequeued before free_request

 drivers/usb/gadget/function/f_fs.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Krishna Kurapati Jan. 12, 2023, 9:59 a.m. UTC | #1
On 12/15/2022 10:59 AM, Udipto Goswami wrote:
> This series will prevent race between ep0_queue_wait &
> functionfs_unbind. Currently, both routines are running
> without any kind of serialization to make sure ep0req
> doesn't get corrupted.
> 
> Changes in v4:
> Split the implementation of v3 [1] into a series for better clarity.
> Also, tested the patches by running USB plug-in/plug-out along with
> composition switch.
> 
> Changes in v3:
> Moved dequeue out of mutex to prevent deadlock.
> 
> Changes in v2:
> Replaces spinlock with mutex & added dequeue operation in unbind.
> 
> [1]: https://patchwork.kernel.org/project/linux-usb/patch/20221125054119.25135-1-quic_ugoswami@quicinc.com/
> 
> Udipto Goswami (2):
>    usb: gadget: f_fs: Prevent race during ffs_ep0_queue_wait
>    usb: gadget: f_fs: Ensure ep0req is dequeued before free_request
> 
>   drivers/usb/gadget/function/f_fs.c | 7 +++++++
>   1 file changed, 7 insertions(+)
> 

Series tested on SM8450.

Tested-by: Krishna Kurapati <quic_kriskura@quicinc.com>

Thanks,
Krishna,