summaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@tv-sign.ru>2006-08-22 21:22:13 +0400
committerGreg Kroah-Hartman <gregkh@suse.de>2006-08-22 12:52:23 -0700
commit2d8f613160ed303f5fe310f21bba334a4b074fa5 (patch)
tree7e6878d6391919019b4904714cfe8fc0ef4709be /block
parent00a2b0f6dd2372842df73de72d51621b539fea44 (diff)
elv_unregister: fix possible crash on module unload
An exiting task or process which didn't do I/O yet have no io context, elv_unregister() should check it is not NULL. Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru> Acked-by: Jens Axboe <axboe@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'block')
-rw-r--r--block/elevator.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/block/elevator.c b/block/elevator.c
index bc7baeec0d1..9b72dc7c8a5 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -765,7 +765,8 @@ void elv_unregister(struct elevator_type *e)
read_lock(&tasklist_lock);
do_each_thread(g, p) {
task_lock(p);
- e->ops.trim(p->io_context);
+ if (p->io_context)
+ e->ops.trim(p->io_context);
task_unlock(p);
} while_each_thread(g, p);
read_unlock(&tasklist_lock);