]> Pileus Git - ~andy/linux/commit
virtio_blk: fix config handler race
authorMichael S. Tsirkin <mst@redhat.com>
Thu, 12 Jan 2012 05:14:44 +0000 (15:44 +1030)
committerRusty Russell <rusty@rustcorp.com.au>
Thu, 12 Jan 2012 05:14:44 +0000 (15:44 +1030)
commit4678d6f970c2f7c0cbfefc0cc666432d153b321b
tree6757c596f991c36b38e4d6bb29df4ad0f49c330d
parente93300b1afc7cd4fe1e741ceaf06714d060e88b8
virtio_blk: fix config handler race

Fix a theoretical race related to config work
handler: a config interrupt might happen
after we flush config work but before we
reset the device. It will then cause the
config work to run during or after reset.

Two problems with this:
- if this runs after device is gone we will get use after free
- access of config while reset is in progress is racy
(as layout is changing).

As a solution
1. flush after reset when we know there will be no more interrupts
2. add a flag to disable config access before reset

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
drivers/block/virtio_blk.c