]> git.baikalelectronics.ru Git - kernel.git/commit
virtio_blk: Fix a slient kernel panic
authorMinfei Huang <mnghuan@gmail.com>
Tue, 9 Aug 2016 08:39:20 +0000 (16:39 +0800)
committerMichael S. Tsirkin <mst@redhat.com>
Tue, 9 Aug 2016 10:42:39 +0000 (13:42 +0300)
commit26d9ecceeebd8c68a508e13af0acdafac45c40a5
tree3dcf003ea2d1c35c342fbd93d9342a4014f25f2c
parent908c5cb4d2ec50eb96315257d3f267e99ebbbc78
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: Chao Fan <fanc.fnst@cn.fujitsu.com>
Signed-off-by: Minfei Huang <mnghuan@gmail.com>
Signed-off-by: Minfei Huang <minfei.hmf@alibaba-inc.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
drivers/block/virtio_blk.c