mirror of https://gitee.com/openkylin/qemu.git
block: Fix anonymous BBs in blk_root_inactivate()
blk->name isn't an array, but a pointer that can be NULL. Checking for an anonymous BB must involve a NULL check first, otherwise we get crashes. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Jeff Cody <jcody@redhat.com>
This commit is contained in:
parent
64175afc69
commit
93c26503e0
|
@ -168,7 +168,7 @@ static int blk_root_inactivate(BdrvChild *child)
|
||||||
* this point because the VM is stopped) and unattached monitor-owned
|
* this point because the VM is stopped) and unattached monitor-owned
|
||||||
* BlockBackends. If there is still any other user like a block job, then
|
* BlockBackends. If there is still any other user like a block job, then
|
||||||
* we simply can't inactivate the image. */
|
* we simply can't inactivate the image. */
|
||||||
if (!blk->dev && !blk->name[0]) {
|
if (!blk->dev && !blk_name(blk)[0]) {
|
||||||
return -EPERM;
|
return -EPERM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue