mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 19:21:31 -04:00
packet: fix reserve calculation
Commitb84bbaf7a6("packet: in packet_snd start writing at link layer allocation") ensures that packet_snd always starts writing the link layer header in reserved headroom allocated for this purpose. This is needed because packets may be shorter than hard_header_len, in which case the space up to hard_header_len may be zeroed. But that necessary padding is not accounted for in skb->len. The fix, however, is buggy. It calls skb_push, which grows skb->len when moving skb->data back. But in this case packet length should not change. Instead, call skb_reserve, which moves both skb->data and skb->tail back, without changing length. Fixes:b84bbaf7a6("packet: in packet_snd start writing at link layer allocation") Reported-by: Tariq Toukan <[email protected]> Signed-off-by: Willem de Bruijn <[email protected]> Acked-by: Soheil Hassas Yeganeh <[email protected]> Signed-off-by: David S. Miller <[email protected]>
This commit is contained in:
parent
d546b67cda
commit
9aad13b087
1 changed files with 1 additions and 1 deletions
|
|
@ -2911,7 +2911,7 @@ static int packet_snd(struct socket *sock, struct msghdr *msg, size_t len)
|
|||
if (unlikely(offset < 0))
|
||||
goto out_free;
|
||||
} else if (reserve) {
|
||||
skb_push(skb, reserve);
|
||||
skb_reserve(skb, -reserve);
|
||||
}
|
||||
|
||||
/* Returns -EFAULT on error */
|
||||
|
|
|
|||
Loading…
Reference in a new issue