Re: [PATCH v3] virtio_blk: Fix a slient kernel panic

From
Minfei Huang <hidden>
Date
2016-07-23 01:58:55
Ping, Any comment is appreciate.

Thanks
Minfei
On Jul 19, 2016, at 20:22, Cornelia Huck [off-list ref] wrote:

On Tue, 19 Jul 2016 12:32:42 +0800
Minfei Huang [off-list ref] wrote:
quoted
From: Minfei Huang <redacted>

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 <redacted>
Signed-off-by: Minfei Huang <redacted>
Signed-off-by: Minfei Huang <redacted>
---
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 <redacted>
  
Thread (1 message) 1 message, 1 author, last reply 2016-07-23
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help