diff options
author | Oleg Nesterov <oleg@tv-sign.ru> | 2006-08-22 13:22:13 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-08-22 15:52:23 -0400 |
commit | 2d8f613160ed303f5fe310f21bba334a4b074fa5 (patch) | |
tree | 7e6878d6391919019b4904714cfe8fc0ef4709be /block/elevator.c | |
parent | 00a2b0f6dd2372842df73de72d51621b539fea44 (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/elevator.c')
-rw-r--r-- | block/elevator.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/block/elevator.c b/block/elevator.c index bc7baeec0d10..9b72dc7c8a5c 100644 --- a/block/elevator.c +++ b/block/elevator.c | |||
@@ -765,7 +765,8 @@ void elv_unregister(struct elevator_type *e) | |||
765 | read_lock(&tasklist_lock); | 765 | read_lock(&tasklist_lock); |
766 | do_each_thread(g, p) { | 766 | do_each_thread(g, p) { |
767 | task_lock(p); | 767 | task_lock(p); |
768 | e->ops.trim(p->io_context); | 768 | if (p->io_context) |
769 | e->ops.trim(p->io_context); | ||
769 | task_unlock(p); | 770 | task_unlock(p); |
770 | } while_each_thread(g, p); | 771 | } while_each_thread(g, p); |
771 | read_unlock(&tasklist_lock); | 772 | read_unlock(&tasklist_lock); |