backing-dev: fix wakeup timer races with bdi_unregister()
authorRabin Vincent <rabin@rab.in>
Sun, 29 Jan 2012 18:17:33 +0000 (12:17 -0600)
committerWu Fengguang <fengguang.wu@intel.com>
Wed, 1 Feb 2012 08:52:49 +0000 (16:52 +0800)
commit2673b4cf5d59c3ee5e0c12f6d734d38770324dc4
treeabef3ab4517f06b629f5dc4c516c135165cf7d81
parent62aa2b537c6f5957afd98e29f96897419ed5ebab
backing-dev: fix wakeup timer races with bdi_unregister()

While 7a401a972df8e18 ("backing-dev: ensure wakeup_timer is deleted")
addressed the problem of the bdi being freed with a queued wakeup
timer, there are other races that could happen if the wakeup timer
expires after/during bdi_unregister(), before bdi_destroy() is called.

wakeup_timer_fn() could attempt to wakeup a task which has already has
been freed, or could access a NULL bdi->dev via the wake_forker_thread
tracepoint.

Cc: <stable@kernel.org>
Cc: Jens Axboe <axboe@kernel.dk>
Reported-by: Chanho Min <chanho.min@lge.com>
Reviewed-by: Namjae Jeon <linkinjeon@gmail.com>
Signed-off-by: Rabin Vincent <rabin@rab.in>
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
mm/backing-dev.c