From: Tom Herbert Date: Mon, 18 Oct 2010 17:55:58 +0000 (+0000) Subject: net: fail alloc_netdev_mq if queue count < 1 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=55513fb4281464e97aa1ff2b9c906ca5aed917c5;p=linux-beck.git net: fail alloc_netdev_mq if queue count < 1 In alloc_netdev_mq fail if requested queue_count < 1. Signed-off-by: Tom Herbert Acked-by: Eric Dumazet Signed-off-by: David S. Miller --- 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, 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 */