]> Git Repo - qemu.git/commit - util/async.c
aio: fix qemu_bh_schedule() bh->ctx race condition
authorStefan Hajnoczi <[email protected]>
Tue, 3 Jun 2014 09:21:01 +0000 (11:21 +0200)
committerStefan Hajnoczi <[email protected]>
Wed, 4 Jun 2014 07:56:06 +0000 (09:56 +0200)
commit924fe1293c3e7a3c787bbdfb351e7f168caee3e9
tree07e385b640afa86d2a411a2195e3a34bb5b52b91
parente00fcfeab3d452cba3d0a08991a39ab15df66424
aio: fix qemu_bh_schedule() bh->ctx race condition

qemu_bh_schedule() is supposed to be thread-safe at least the first time
it is called.  Unfortunately this is not quite true:

  bh->scheduled = 1;
  aio_notify(bh->ctx);

Since another thread may run the BH callback once it has been scheduled,
there is a race condition if the callback frees the BH before
aio_notify(bh->ctx) has a chance to run.

Reported-by: Stefan Priebe <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
Reviewed-by: Paolo Bonzini <[email protected]>
Tested-by: Stefan Priebe <[email protected]>
async.c
This page took 0.0242 seconds and 4 git commands to generate.