lkml.org 
[lkml]   [2016]   [Jul]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3] virtio_blk: Fix a slient kernel panic
On Tue, 19 Jul 2016 12:32:42 +0800
Minfei Huang <mnfhuang@gmail.com> wrote:

> From: Minfei Huang <mnghuan@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.fnst@cn.fujitsu.com>
> Signed-off-by: Minfei Huang <minfei.hmf@alibaba-inc.com>
> Signed-off-by: Minfei Huang <mnghuan@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(-)

Your changes certainly make the function more compact.

Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>

\
 
 \ /
  Last update: 2016-07-19 15:01    [W:1.701 / U:0.592 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site