packet: reset network header if packet shorter than ll reserved space
[ Upstream commit993675a310
] If variable length link layer headers result in a packet shorter than dev->hard_header_len, reset the network header offset. Else skb->mac_len may exceed skb->len after skb_mac_reset_len. packet_sendmsg_spkt already has similar logic. Fixes:b84bbaf7a6
("packet: in packet_snd start writing at link layer allocation") Signed-off-by: Willem de Bruijn <willemb@google.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Sasha Levin <alexander.levin@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Родитель
edf81993dc
Коммит
75425326b8
|
@ -2919,6 +2919,8 @@ static int packet_snd(struct socket *sock, struct msghdr *msg, size_t len)
|
|||
goto out_free;
|
||||
} else if (reserve) {
|
||||
skb_reserve(skb, -reserve);
|
||||
if (len < reserve)
|
||||
skb_reset_network_header(skb);
|
||||
}
|
||||
|
||||
/* Returns -EFAULT on error */
|
||||
|
|
Загрузка…
Ссылка в новой задаче