diff options
author | Insu Yun <wuninsu@gmail.com> | 2015-10-15 20:02:28 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-10-19 04:37:29 +0200 |
commit | 833b8f18adfcca04070a8a42d545a4553379d36f (patch) | |
tree | ea6c9a572819d080cc1982779dd802eb110fad0c /drivers/net/xen-netback/xenbus.c | |
parent | net: asix: add support for the Billionton GUSB2AM-1G-B USB adapter (diff) | |
download | linux-833b8f18adfcca04070a8a42d545a4553379d36f.tar.xz linux-833b8f18adfcca04070a8a42d545a4553379d36f.zip |
xen-netback: correctly check failed allocation
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>
Diffstat (limited to 'drivers/net/xen-netback/xenbus.c')
-rw-r--r-- | drivers/net/xen-netback/xenbus.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/net/xen-netback/xenbus.c b/drivers/net/xen-netback/xenbus.c index 929a6e7e5ecf..56ebd8267386 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; |