This is a note to let you know that I've just added the patch titled

    writeback: fix dereferencing NULL bdi->dev on trace_writeback_queue

to the 3.2-stable tree which can be found at:
    
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     writeback-fix-dereferencing-null-bdi-dev-on-trace_writeback_queue.patch
and it can be found in the queue-3.2 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <[email protected]> know about it.


>From 977b7e3a52a7421ad33a393a38ece59f3d41c2fa Mon Sep 17 00:00:00 2001
From: Wu Fengguang <[email protected]>
Date: Sat, 4 Feb 2012 20:54:03 -0600
Subject: writeback: fix dereferencing NULL bdi->dev on trace_writeback_queue

From: Wu Fengguang <[email protected]>

commit 977b7e3a52a7421ad33a393a38ece59f3d41c2fa upstream.

When a SD card is hot removed without umount, del_gendisk() will call
bdi_unregister() without destroying/freeing it. This leaves the bdi in
the bdi->dev = NULL, bdi->wb.task = NULL, bdi->bdi_list removed state.

When sync(2) gets the bdi before bdi_unregister() and calls
bdi_queue_work() after the unregister, trace_writeback_queue will be
dereferencing the NULL bdi->dev. Fix it with a simple test for NULL.

LKML-reference: http://lkml.org/lkml/2012/1/18/346
Reported-by: Rabin Vincent <[email protected]>
Tested-by: Namjae Jeon <[email protected]>
Signed-off-by: Wu Fengguang <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
 include/trace/events/writeback.h |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

--- a/include/trace/events/writeback.h
+++ b/include/trace/events/writeback.h
@@ -47,7 +47,10 @@ DECLARE_EVENT_CLASS(writeback_work_class
                __field(int, reason)
        ),
        TP_fast_assign(
-               strncpy(__entry->name, dev_name(bdi->dev), 32);
+               struct device *dev = bdi->dev;
+               if (!dev)
+                       dev = default_backing_dev_info.dev;
+               strncpy(__entry->name, dev_name(dev), 32);
                __entry->nr_pages = work->nr_pages;
                __entry->sb_dev = work->sb ? work->sb->s_dev : 0;
                __entry->sync_mode = work->sync_mode;


Patches currently in stable-queue which might be from [email protected] are

queue-3.2/writeback-fix-dereferencing-null-bdi-dev-on-trace_writeback_queue.patch
queue-3.2/lib-proportion-lower-prop_max_shift-to-32-on-64-bit-kernel.patch
queue-3.2/writeback-fix-null-bdi-dev-in-trace-writeback_single_inode.patch
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to