mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 12:43:29 +02:00
firewire: net: fix use after free in fwnet_finish_incoming_packet()
The netif_rx() function frees the skb so we can't dereference it to save the skb->len. Signed-off-by: Zhang Shurong <zhang_shurong@foxmail.com> Link: https://lore.kernel.org/r/tencent_3B3D24B66ED66A6BB73CC0E63C6A14E45109@qq.com Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
This commit is contained in:
committed by
Takashi Sakamoto
parent
06f45435d9
commit
3ff256751a
@@ -479,7 +479,7 @@ static int fwnet_finish_incoming_packet(struct net_device *net,
|
|||||||
struct sk_buff *skb, u16 source_node_id,
|
struct sk_buff *skb, u16 source_node_id,
|
||||||
bool is_broadcast, u16 ether_type)
|
bool is_broadcast, u16 ether_type)
|
||||||
{
|
{
|
||||||
int status;
|
int status, len;
|
||||||
|
|
||||||
switch (ether_type) {
|
switch (ether_type) {
|
||||||
case ETH_P_ARP:
|
case ETH_P_ARP:
|
||||||
@@ -533,13 +533,15 @@ static int fwnet_finish_incoming_packet(struct net_device *net,
|
|||||||
}
|
}
|
||||||
skb->protocol = protocol;
|
skb->protocol = protocol;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
len = skb->len;
|
||||||
status = netif_rx(skb);
|
status = netif_rx(skb);
|
||||||
if (status == NET_RX_DROP) {
|
if (status == NET_RX_DROP) {
|
||||||
net->stats.rx_errors++;
|
net->stats.rx_errors++;
|
||||||
net->stats.rx_dropped++;
|
net->stats.rx_dropped++;
|
||||||
} else {
|
} else {
|
||||||
net->stats.rx_packets++;
|
net->stats.rx_packets++;
|
||||||
net->stats.rx_bytes += skb->len;
|
net->stats.rx_bytes += len;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Reference in New Issue
Block a user