[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5177367.3UXkd1Z6lS@al>
Date: Tue, 20 Aug 2013 00:45:53 +0200
From: Peter Wu <lekensteyn@...il.com>
To: Alan Stern <stern@...land.harvard.edu>,
Kernel development list <linux-kernel@...r.kernel.org>
Cc: Tejun Heo <tj@...nel.org>, Jens Axboe <axboe@...nel.dk>
Subject: [PATCH] writeback: fix NULL dereference when device is gone
From: Peter Wu <lekensteyn@...il.com>
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@...il.com>
---
fs/fs-writeback.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index 68851ff..6e38a8b 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() ||
--
1.8.3.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists