提交 833b8f18 编写于 作者: I Insu Yun 提交者: David S. Miller

xen-netback: correctly check failed allocation

Since vzalloc can be failed in memory pressure,
writes -ENOMEM to xenstore to indicate error.
Signed-off-by: NInsu Yun <wuninsu@gmail.com>
Acked-by: NWei Liu <wei.liu2@citrix.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 80083a3c
...@@ -788,6 +788,12 @@ static void connect(struct backend_info *be) ...@@ -788,6 +788,12 @@ static void connect(struct backend_info *be)
/* Use the number of queues requested by the frontend */ /* Use the number of queues requested by the frontend */
be->vif->queues = vzalloc(requested_num_queues * be->vif->queues = vzalloc(requested_num_queues *
sizeof(struct xenvif_queue)); 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->num_queues = requested_num_queues;
be->vif->stalled_queues = requested_num_queues; be->vif->stalled_queues = requested_num_queues;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册