On Tue, Jul 19, 2016 at 5:32 AM, Minfei Huang <mnfhu...@gmail.com> wrote:
> From: Minfei Huang <mngh...@gmail.com>
>
> 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.f...@cn.fujitsu.com>
> Signed-off-by: Minfei Huang <minfei....@alibaba-inc.com>
> Signed-off-by: Minfei Huang <mngh...@gmail.com>
> ---
> v2:
> - Remove useless initialisation to NULL
> v1:
> - Refactor the patch to make code more readable
> ---
>  drivers/block/virtio_blk.c | 26 ++++++++------------------
>  1 file changed, 8 insertions(+), 18 deletions(-)

Reviewed-by: Stefan Hajnoczi <stefa...@redhat.com>

Reply via email to