diff options
author | Xie He <xie.he.0141@gmail.com> | 2020-07-24 19:33:47 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-08-05 10:59:51 +0300 |
commit | 1aff51292ee881f79b226915ef15bdcb87a95fe2 (patch) | |
tree | 8cef00c8792756a9f24d0a5a1a85aaba10d1bde7 /virt/kvm/arm/mmu.c | |
parent | f88c909dc28cf7a3160cd62bcc23aace5d4fbe3d (diff) | |
download | linux-1aff51292ee881f79b226915ef15bdcb87a95fe2.tar.xz |
drivers/net/wan: lapb: Corrected the usage of skb_cow
[ Upstream commit 8754e1379e7089516a449821f88e1fe1ebbae5e1 ]
This patch fixed 2 issues with the usage of skb_cow in LAPB drivers
"lapbether" and "hdlc_x25":
1) After skb_cow fails, kfree_skb should be called to drop a reference
to the skb. But in both drivers, kfree_skb is not called.
2) skb_cow should be called before skb_push so that is can ensure the
safety of skb_push. But in "lapbether", it is incorrectly called after
skb_push.
More details about these 2 issues:
1) The behavior of calling kfree_skb on failure is also the behavior of
netif_rx, which is called by this function with "return netif_rx(skb);".
So this function should follow this behavior, too.
2) In "lapbether", skb_cow is called after skb_push. This results in 2
logical issues:
a) skb_push is not protected by skb_cow;
b) An extra headroom of 1 byte is ensured after skb_push. This extra
headroom has no use in this function. It also has no use in the
upper-layer function that this function passes the skb to
(x25_lapb_receive_frame in net/x25/x25_dev.c).
So logically skb_cow should instead be called before skb_push.
Cc: Eric Dumazet <edumazet@google.com>
Cc: Martin Schiller <ms@dev.tdt.de>
Signed-off-by: Xie He <xie.he.0141@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'virt/kvm/arm/mmu.c')
0 files changed, 0 insertions, 0 deletions