projects
/
linux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
1daec08
)
net: hsr: Fix potential use-after-free
author
YueHaibing
<yuehaibing@huawei.com>
Fri, 25 Nov 2022 07:57:24 +0000
(15:57 +0800)
committer
Greg Kroah-Hartman
<gregkh@linuxfoundation.org>
Thu, 8 Dec 2022 10:28:41 +0000
(11:28 +0100)
[ Upstream commit
7e177d32442b7ed08a9fa61b61724abc548cb248
]
The skb is delivered to netif_rx() which may free it, after calling this,
dereferencing skb may trigger use-after-free.
Fixes: f421436a591d ("net/hsr: Add support for the High-availability Seamless Redundancy protocol (HSRv0)")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Link:
https://lore.kernel.org/r/20221125075724.27912-1-yuehaibing@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/hsr/hsr_forward.c
patch
|
blob
|
history
diff --git
a/net/hsr/hsr_forward.c
b/net/hsr/hsr_forward.c
index 13f81c246f5f52ced520c73c21e045a27fdb6c6e..07892c4b6d0c6ba1feb25798ec76b5e79eb7683c 100644
(file)
--- a/
net/hsr/hsr_forward.c
+++ b/
net/hsr/hsr_forward.c
@@
-309,17
+309,18
@@
static void hsr_deliver_master(struct sk_buff *skb, struct net_device *dev,
struct hsr_node *node_src)
{
bool was_multicast_frame;
- int res;
+ int res
, recv_len
;
was_multicast_frame = (skb->pkt_type == PACKET_MULTICAST);
hsr_addr_subst_source(node_src, skb);
skb_pull(skb, ETH_HLEN);
+ recv_len = skb->len;
res = netif_rx(skb);
if (res == NET_RX_DROP) {
dev->stats.rx_dropped++;
} else {
dev->stats.rx_packets++;
- dev->stats.rx_bytes +=
skb->
len;
+ dev->stats.rx_bytes +=
recv_
len;
if (was_multicast_frame)
dev->stats.multicast++;
}