diff options
author | Oleg Nesterov <oleg@tv-sign.ru> | 2006-08-22 21:22:13 +0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-08-22 12:04:55 -0700 |
commit | 4bf7989b2326fecad1181985f5fa9860d50fb89f (patch) | |
tree | 5708d8a0cd00254b51b61fe163d56d722fb9ecb3 | |
parent | 7127be29378b1230eb8dd8b84f18d6b69c56e959 (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>
-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 a0afdd317cef..7be96bbe142c 100644 --- a/block/elevator.c +++ b/block/elevator.c @@ -766,7 +766,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); |