netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] xen-netback: corretly check failed allocation
@ 2015-10-15 16:26 Insu Yun
  2015-10-15 16:44 ` Ian Campbell
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Insu Yun @ 2015-10-15 16:26 UTC (permalink / raw)
  To: ian.campbell, wei.liu2, xen-devel, netdev, linux-kernel
  Cc: taesoo, yeongjin.jang, insu, Insu Yun

Since vzalloc can be failed in memory pressure,
return value should be checked and return ENOMEM.

Signed-off-by: Insu Yun <wuninsu@gmail.com>
---
 drivers/net/xen-netback/xenbus.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/xen-netback/xenbus.c b/drivers/net/xen-netback/xenbus.c
index 929a6e7..e288246 100644
--- a/drivers/net/xen-netback/xenbus.c
+++ b/drivers/net/xen-netback/xenbus.c
@@ -788,6 +788,11 @@ static void connect(struct backend_info *be)
 	/* Use the number of queues requested by the frontend */
 	be->vif->queues = vzalloc(requested_num_queues *
 				  sizeof(struct xenvif_queue));
+  if (!be->vif->queues)  {
+    xenbus_dev_fatal(dev, -ENOMEM, "allocating queues");
+    return;
+  }
+
 	be->vif->num_queues = requested_num_queues;
 	be->vif->stalled_queues = requested_num_queues;
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-10-16  6:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-15 16:26 [PATCH] xen-netback: corretly check failed allocation Insu Yun
2015-10-15 16:44 ` Ian Campbell
2015-10-15 17:13 ` Wei Liu
2015-10-15 17:27   ` Insu Yun
2015-10-16  6:32 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).