]> Git Repo - qemu.git/commit
block: Do not unref bs->file on error in BD's open
authorMax Reitz <[email protected]>
Thu, 13 Apr 2017 15:43:34 +0000 (17:43 +0200)
committerKevin Wolf <[email protected]>
Thu, 27 Apr 2017 14:12:13 +0000 (16:12 +0200)
commitde234897b60e034ba94b307fc289e2dc692c9251
tree5778d41ef867df19810e33e7451f956e3b047d25
parent24dfdfd0ff79ea094c41eb34d9acdc0a689d5617
block: Do not unref bs->file on error in BD's open

The block layer takes care of removing the bs->file child if the block
driver's bdrv_open()/bdrv_file_open() implementation fails. The block
driver therefore does not need to do so, and indeed should not unless it
sets bs->file to NULL afterwards -- because if this is not done, the
bdrv_unref_child() in bdrv_open_inherit() will dereference the freed
memory block at bs->file afterwards, which is not good.

We can now decide whether to add a "bs->file = NULL;" after each of the
offending bdrv_unref_child() invocations, or just drop them altogether.
The latter is simpler, so let's do that.

Cc: qemu-stable <[email protected]>
Signed-off-by: Max Reitz <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Reviewed-by: Stefan Hajnoczi <[email protected]>
Signed-off-by: Kevin Wolf <[email protected]>
block/blkdebug.c
block/blkreplay.c
block/blkverify.c
This page took 0.026521 seconds and 4 git commands to generate.