mirror of
https://github.com/torvalds/linux.git
synced 2024-11-29 07:31:29 +00:00
Merge branch 'net-af_packet-be-careful-when-expanding-mac-header-size'
Eric Dumazet says: ==================== net: af_packet: be careful when expanding mac header size A recent regression in af_packet needed a preliminary debug patch, which will presumably be useful for next bugs hunting. The af_packet fix is to make sure MAC headers are contained in skb linear part, as GSO stack requests. v2: CONFIG_DEBUG_NET depends on CONFIG_NET to avoid compile errors found by kernel bots. ==================== Link: https://lore.kernel.org/r/20220602161859.2546399-1-eric.dumazet@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
commit
638696efc1
@ -2696,7 +2696,14 @@ void *skb_pull(struct sk_buff *skb, unsigned int len);
|
||||
static inline void *__skb_pull(struct sk_buff *skb, unsigned int len)
|
||||
{
|
||||
skb->len -= len;
|
||||
BUG_ON(skb->len < skb->data_len);
|
||||
if (unlikely(skb->len < skb->data_len)) {
|
||||
#if defined(CONFIG_DEBUG_NET)
|
||||
skb->len += len;
|
||||
pr_err("__skb_pull(len=%u)\n", len);
|
||||
skb_dump(KERN_ERR, skb, false);
|
||||
#endif
|
||||
BUG();
|
||||
}
|
||||
return skb->data += len;
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,7 @@ config NET_NS_REFCNT_TRACKER
|
||||
|
||||
config DEBUG_NET
|
||||
bool "Add generic networking debug"
|
||||
depends on DEBUG_KERNEL
|
||||
depends on DEBUG_KERNEL && NET
|
||||
help
|
||||
Enable extra sanity checks in networking.
|
||||
This is mostly used by fuzzers, but is safe to select.
|
||||
|
@ -1935,8 +1935,10 @@ static void packet_parse_headers(struct sk_buff *skb, struct socket *sock)
|
||||
/* Move network header to the right position for VLAN tagged packets */
|
||||
if (likely(skb->dev->type == ARPHRD_ETHER) &&
|
||||
eth_type_vlan(skb->protocol) &&
|
||||
__vlan_get_protocol(skb, skb->protocol, &depth) != 0)
|
||||
skb_set_network_header(skb, depth);
|
||||
__vlan_get_protocol(skb, skb->protocol, &depth) != 0) {
|
||||
if (pskb_may_pull(skb, depth))
|
||||
skb_set_network_header(skb, depth);
|
||||
}
|
||||
|
||||
skb_probe_transport_header(skb);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user