diff options
| author | Khazhismel Kumykov <[email protected]> | 2022-08-01 15:50:34 +0000 |
|---|---|---|
| committer | Andrew Morton <[email protected]> | 2022-08-28 21:02:43 +0000 |
| commit | f87904c075515f3e1d8f4a7115869d3b914674fd (patch) | |
| tree | 311757d653b1ef1229b68692699e5b63949ba911 /drivers/usb/cdns3/cdns3-imx.c | |
| parent | shmem: update folio if shmem_replace_page() updates the page (diff) | |
| download | kernel-f87904c075515f3e1d8f4a7115869d3b914674fd.tar.gz kernel-f87904c075515f3e1d8f4a7115869d3b914674fd.zip | |
writeback: avoid use-after-free after removing device
When a disk is removed, bdi_unregister gets called to stop further
writeback and wait for associated delayed work to complete. However,
wb_inode_writeback_end() may schedule bandwidth estimation dwork after
this has completed, which can result in the timer attempting to access the
just freed bdi_writeback.
Fix this by checking if the bdi_writeback is alive, similar to when
scheduling writeback work.
Since this requires wb->work_lock, and wb_inode_writeback_end() may get
called from interrupt, switch wb->work_lock to an irqsafe lock.
Link: https://lkml.kernel.org/r/[email protected]
Fixes: 45a2966fd641 ("writeback: fix bandwidth estimate for spiky workload")
Signed-off-by: Khazhismel Kumykov <[email protected]>
Reviewed-by: Jan Kara <[email protected]>
Cc: Michael Stapelberg <[email protected]>
Cc: Wu Fengguang <[email protected]>
Cc: Alexander Viro <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Diffstat (limited to 'drivers/usb/cdns3/cdns3-imx.c')
0 files changed, 0 insertions, 0 deletions
