summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Wu <lekensteyn@gmail.com>2013-08-20 00:32:14 +0200
committerPeter Wu <lekensteyn@gmail.com>2013-08-20 00:32:14 +0200
commit77cf8f5c28d302ceb0ab64bd0af9cab1ad85fac2 (patch)
tree1506f4fa4e3150dce60b8af8a2111d802b2c729a
parent94fc5d9de5bd757ad46f0d94bc4ebf617c4487f6 (diff)
downloadlinux-77cf8f5c28d302ceb0ab64bd0af9cab1ad85fac2.tar.gz
writeback: fix NULL dereference when device is goneblockdev
This solves a BUG followed by a lockup in the following case: 1. Connect device and look in dmesg for the address: [ 40.034520] usb 6-2: Product: My Passport 0748 2. Write something: dd if=/dev/zero of=/dev/sdd bs=1M 3. Remove device: echo 1 > /sys/bus/usb/devices/6-2/remove 4. Machine locks up (because the work queue got stuck?). Signed-off-by: Peter Wu <lekensteyn@gmail.com>
-rw-r--r--fs/fs-writeback.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index 68851ff2fd41..6e38a8b50b9a 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -1007,7 +1007,8 @@ void bdi_writeback_workfn(struct work_struct *work)
struct backing_dev_info *bdi = wb->bdi;
long pages_written;
- set_worker_desc("flush-%s", dev_name(bdi->dev));
+ if (bdi->dev)
+ set_worker_desc("flush-%s", dev_name(bdi->dev));
current->flags |= PF_SWAPWRITE;
if (likely(!current_is_workqueue_rescuer() ||