All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xen-netback: correctly check failed allocation
@ 2015-10-15 18:02 Insu Yun
  2015-10-15 18:02 ` Insu Yun
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Insu Yun @ 2015-10-15 18:02 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,
writes -ENOMEM to xenstore to indicate error.

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

diff --git a/drivers/net/xen-netback/xenbus.c b/drivers/net/xen-netback/xenbus.c
index 929a6e7..56ebd82 100644
--- a/drivers/net/xen-netback/xenbus.c
+++ b/drivers/net/xen-netback/xenbus.c
@@ -788,6 +788,12 @@ 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] 11+ messages in thread

end of thread, other threads:[~2015-10-19  2:21 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-15 18:02 [PATCH] xen-netback: correctly check failed allocation Insu Yun
2015-10-15 18:02 ` Insu Yun
2015-10-16  9:05   ` Wei Liu
2015-10-16  9:05   ` Wei Liu
2015-10-16  9:28     ` Wei Liu
2015-10-16  9:28     ` Wei Liu
2015-10-16  9:40     ` [Xen-devel] " David Vrabel
2015-10-16 12:48       ` Insu Yun
2015-10-16  9:40     ` David Vrabel
2015-10-19  2:37 ` David Miller
2015-10-19  2:37 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.