net: fail alloc_netdev_mq if queue count < 1
authorTom Herbert <therbert@google.com>
Mon, 18 Oct 2010 17:55:58 +0000 (17:55 +0000)
committerDavid S. Miller <davem@davemloft.net>
Wed, 20 Oct 2010 09:27:58 +0000 (02:27 -0700)
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>
net/core/dev.c

index 04972a4783e2e9b75c54fd5c8e30bfedcf674ecc..f44d29ae5d6735f00e3346b987e330b18f65f86a 100644 (file)
@@ -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 */