提交 31ce72a6 编写于 作者: P Patrick McHardy 提交者: David S. Miller

[NET]: Fix loopback crashes when multiqueue is enabled.

From: Patrick McHardy <kaber@trash.net>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 fc7b9380
...@@ -575,7 +575,7 @@ struct net_device ...@@ -575,7 +575,7 @@ struct net_device
/* The TX queue control structures */ /* The TX queue control structures */
unsigned int egress_subqueue_count; 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) #define to_net_dev(d) container_of(d, struct net_device, dev)
......
...@@ -3624,7 +3624,7 @@ struct net_device *alloc_netdev_mq(int sizeof_priv, const char *name, ...@@ -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 */ /* ensure 32-byte alignment of both the device and private area */
alloc_size = (sizeof(*dev) + NETDEV_ALIGN_CONST + 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; ~NETDEV_ALIGN_CONST;
alloc_size += sizeof_priv + 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, ...@@ -3642,7 +3642,7 @@ struct net_device *alloc_netdev_mq(int sizeof_priv, const char *name,
dev->priv = ((char *)dev + dev->priv = ((char *)dev +
((sizeof(struct net_device) + ((sizeof(struct net_device) +
(sizeof(struct net_device_subqueue) * (sizeof(struct net_device_subqueue) *
queue_count) + NETDEV_ALIGN_CONST) (queue_count - 1)) + NETDEV_ALIGN_CONST)
& ~NETDEV_ALIGN_CONST)); & ~NETDEV_ALIGN_CONST));
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册