From: Patrick McHardy Date: Sat, 21 Jul 2007 02:45:45 +0000 (-0700) Subject: [NET]: Fix loopback crashes when multiqueue is enabled. X-Git-Tag: v2.6.23-rc1~37^2~6 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=31ce72a6b1c7635259cf522459539c0611f2c50c;p=linux-2.6 [NET]: Fix loopback crashes when multiqueue is enabled. From: Patrick McHardy Signed-off-by: David S. Miller --- diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 9820ca1e45..4a616d73cc 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -575,7 +575,7 @@ struct net_device /* The TX queue control structures */ unsigned int egress_subqueue_count; - struct net_device_subqueue egress_subqueue[0]; + struct net_device_subqueue egress_subqueue[1]; }; #define to_net_dev(d) container_of(d, struct net_device, dev) diff --git a/net/core/dev.c b/net/core/dev.c index 38212c3f99..ee4035571c 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -3624,7 +3624,7 @@ struct net_device *alloc_netdev_mq(int sizeof_priv, const char *name, /* ensure 32-byte alignment of both the device and private area */ alloc_size = (sizeof(*dev) + NETDEV_ALIGN_CONST + - (sizeof(struct net_device_subqueue) * queue_count)) & + (sizeof(struct net_device_subqueue) * (queue_count - 1))) & ~NETDEV_ALIGN_CONST; alloc_size += sizeof_priv + NETDEV_ALIGN_CONST; @@ -3642,7 +3642,7 @@ struct net_device *alloc_netdev_mq(int sizeof_priv, const char *name, dev->priv = ((char *)dev + ((sizeof(struct net_device) + (sizeof(struct net_device_subqueue) * - queue_count) + NETDEV_ALIGN_CONST) + (queue_count - 1)) + NETDEV_ALIGN_CONST) & ~NETDEV_ALIGN_CONST)); }