Skip to content

Commit

Permalink
xen-netback: correctly check failed allocation
Browse files Browse the repository at this point in the history
Since vzalloc can be failed in memory pressure,
writes -ENOMEM to xenstore to indicate error.

Signed-off-by: Insu Yun <wuninsu@gmail.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Insu Yun authored and David S. Miller committed Oct 19, 2015
1 parent 80083a3 commit 833b8f1
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/net/xen-netback/xenbus.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 833b8f1

Please sign in to comment.