]> 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)
commit39ae1ecb1da90b695aae019ddcda10e02caca00a
tree3dcf003ea2d1c35c342fbd93d9342a4014f25f2c
parentf754facb63a50823b94e0f46a01b74a0eede300d
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