From: Peter Wu <lekensteyn@gmail.com>
To: Alan Stern <stern@rowland.harvard.edu>,
Kernel development list <linux-kernel@vger.kernel.org>
Cc: Tejun Heo <tj@kernel.org>, Jens Axboe <axboe@kernel.dk>
Subject: [PATCH] writeback: fix NULL dereference when device is gone
Date: Tue, 20 Aug 2013 00:45:53 +0200 [thread overview]
Message-ID: <5177367.3UXkd1Z6lS@al> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1308172104070.7744-100000@netrider.rowland.org>
From: Peter Wu <lekensteyn@gmail.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@gmail.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
next prev parent reply other threads:[~2013-08-19 22:46 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-18 1:08 [3.11-rc5..] NULL pointer dereference in bdi_writeback_workfn Alan Stern
2013-08-19 22:45 ` Peter Wu [this message]
2013-08-19 23:02 ` [PATCH] writeback: fix NULL dereference when device is gone Tejun Heo
2013-08-20 10:13 ` Peter Wu
2013-08-20 13:33 ` Tejun Heo
2013-08-28 22:31 ` Peter Wu
2013-09-04 18:21 ` Tejun Heo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5177367.3UXkd1Z6lS@al \
--to=lekensteyn@gmail.com \
--cc=axboe@kernel.dk \
--cc=linux-kernel@vger.kernel.org \
--cc=stern@rowland.harvard.edu \
--cc=tj@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).