]> err.no Git - linux-2.6/commitdiff
elv_unregister: fix possible crash on module unload
authorOleg Nesterov <oleg@tv-sign.ru>
Tue, 22 Aug 2006 17:22:13 +0000 (21:22 +0400)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 22 Aug 2006 19:52:23 +0000 (12:52 -0700)
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>
block/elevator.c

index bc7baeec0d102014c07ec7308d54dbc2161e4ba9..9b72dc7c8a5c98dcde87dc0d7e42d9a56f447776 100644 (file)
@@ -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);