diff options
author | Tom Herbert <therbert@google.com> | 2010-10-18 13:55:58 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-10-20 05:27:58 -0400 |
commit | 55513fb4281464e97aa1ff2b9c906ca5aed917c5 (patch) | |
tree | d90d3ea475c0d2b1f00e8b662d112c3c608f3a7c | |
parent | 5eeaa2db162f1f6d83e988d4d28f4ba7be600e44 (diff) |
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>
-rw-r--r-- | net/core/dev.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index 04972a4783e2..f44d29ae5d67 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, | |||
5511 | 5511 | ||
5512 | BUG_ON(strlen(name) >= sizeof(dev->name)); | 5512 | BUG_ON(strlen(name) >= sizeof(dev->name)); |
5513 | 5513 | ||
5514 | if (queue_count < 1) { | ||
5515 | pr_err("alloc_netdev: Unable to allocate device " | ||
5516 | "with zero queues.\n"); | ||
5517 | return NULL; | ||
5518 | } | ||
5519 | |||
5514 | alloc_size = sizeof(struct net_device); | 5520 | alloc_size = sizeof(struct net_device); |
5515 | if (sizeof_priv) { | 5521 | if (sizeof_priv) { |
5516 | /* ensure 32-byte alignment of private area */ | 5522 | /* ensure 32-byte alignment of private area */ |