virtio_blk: Fix a slient kernel panic
We do a lot of memory allocation in function init_vq, and don't handle the allocation failure properly. Then this function will return 0, although initialization fails due to lacking memory. At that moment, kernel will panic in guest machine, if virtio is used to drive disk. To fix this bug, we should take care of allocation failure, and return correct value to let caller know what happen. Tested-by: NChao Fan <fanc.fnst@cn.fujitsu.com> Signed-off-by: NMinfei Huang <mnghuan@gmail.com> Signed-off-by: NMinfei Huang <minfei.hmf@alibaba-inc.com> Reviewed-by: NCornelia Huck <cornelia.huck@de.ibm.com> Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com> Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
Showing
想要评论请 注册 或 登录