Re: [PATCH v2] staging: rtl8192u: Fix sleep in atomic context bug in dm_fsync_timer_callback

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

On Thu, 23 Jun 2022 11:46:41 +0200 Greg KH wrote:

> On Thu, Jun 23, 2022 at 01:59:12PM +0800, Duoming Zhou wrote:
> > There are sleep in atomic context bugs when dm_fsync_timer_callback is
> > executing. The root cause is that the memory allocation functions with
> > GFP_KERNEL or GFP_NOIO parameters are called in dm_fsync_timer_callback
> > which is a timer handler. The call paths that could trigger bugs are
> > shown below:
> > 
> >     (interrupt context)
> > dm_fsync_timer_callback
> >   write_nic_byte
> >     kzalloc(sizeof(data), GFP_KERNEL); //may sleep
> >     usb_control_msg
> >       kmalloc(.., GFP_NOIO); //may sleep
> >   write_nic_dword
> >     kzalloc(sizeof(data), GFP_KERNEL); //may sleep
> >     usb_control_msg
> >       kmalloc(.., GFP_NOIO); //may sleep
> > 
> > This patch uses delayed work to replace timer and moves the operations
> > that may sleep into the delayed work in order to mitigate bugs.
> > 
> > Fixes: 8fc8598e61f6 ("Staging: Added Realtek rtl8192u driver to staging")
> > Signed-off-by: Duoming Zhou <duoming@xxxxxxxxxx>
> > ---
> > Changes in v2:
> >   - Use delayed work to replace timer.
> 
> Did you test this with real hardware to verify it still works?

I am testing this and I will give you feedback within one or two days.

Best regards,
Duoming Zhou




[Index of Archives]     [Linux Driver Development]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux