nbd: fix use after free on module unload
authorJosef Bacik <josef@toxicpanda.com>
Fri, 28 Apr 2017 13:49:19 +0000 (09:49 -0400)
committerJens Axboe <axboe@fb.com>
Fri, 28 Apr 2017 14:04:01 +0000 (08:04 -0600)
commit60ae36ad0340b1ba88530d6a5e141455dd3afd81
tree53c39316d3556a156734ef78ab5300874ff53d6a
parentbf290f8f98b1a22fe131fa517ef66efb846cf849
nbd: fix use after free on module unload

list_for_each_entry() isn't super safe if we're freeing the objects
while we traverse the list.  Also don't bother taking the extra
reference, the module refcounting stuff will save us from having anybody
messing with the device while we're trying to unload.

Reported-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
drivers/block/nbd.c