From: Wu Fengguang Date: Sun, 5 Feb 2012 02:54:03 +0000 (-0600) Subject: writeback: fix dereferencing NULL bdi->dev on trace_writeback_queue X-Git-Tag: v3.3-rc4~36^2 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=977b7e3a52a7421ad33a393a38ece59f3d41c2fa;p=pandora-kernel.git writeback: fix dereferencing NULL bdi->dev on trace_writeback_queue 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 Cc: stable@kernel.org Reported-by: Rabin Vincent Tested-by: Namjae Jeon Signed-off-by: Wu Fengguang --- Reading git-diff-tree failed