summaryrefslogtreecommitdiffstats
path: root/net/core
diff options
context:
space:
mode:
authorTom Herbert <therbert@google.com>2010-10-18 17:55:58 +0000
committerDavid S. Miller <davem@davemloft.net>2010-10-20 02:27:58 -0700
commit55513fb4281464e97aa1ff2b9c906ca5aed917c5 (patch)
treed90d3ea475c0d2b1f00e8b662d112c3c608f3a7c /net/core
parent5eeaa2db162f1f6d83e988d4d28f4ba7be600e44 (diff)
downloadop-kernel-dev-55513fb4281464e97aa1ff2b9c906ca5aed917c5.zip
op-kernel-dev-55513fb4281464e97aa1ff2b9c906ca5aed917c5.tar.gz
net: fail alloc_netdev_mq if queue count < 1
In alloc_netdev_mq fail if requested queue_count < 1. Signed-off-by: Tom Herbert <therbert@google.com> Acked-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r--net/core/dev.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index 04972a4..f44d29a 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -5511,6 +5511,12 @@ struct net_device *alloc_netdev_mq(int sizeof_priv, const char *name,
BUG_ON(strlen(name) >= sizeof(dev->name));
+ if (queue_count < 1) {
+ pr_err("alloc_netdev: Unable to allocate device "
+ "with zero queues.\n");
+ return NULL;
+ }
+
alloc_size = sizeof(struct net_device);
if (sizeof_priv) {
/* ensure 32-byte alignment of private area */
OpenPOWER on IntegriCloud