diff options
author | Insu Yun <wuninsu@gmail.com> | 2015-10-15 18:02:28 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-10-18 19:37:29 -0700 |
commit | 833b8f18adfcca04070a8a42d545a4553379d36f (patch) | |
tree | ea6c9a572819d080cc1982779dd802eb110fad0c | |
parent | 80083a3c02ef4451edeef31a6f9afe130078f2bf (diff) | |
download | blackbird-op-linux-833b8f18adfcca04070a8a42d545a4553379d36f.tar.gz blackbird-op-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>
-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; |