zephyr/subsys/net/l2/ethernet
Krishna T 55802e5e86 net: l2: ethernet: Fix double free
In the case of no ARP entry, the incoming packet is added to the ARP's
pending queue, while ARP is being resolved. Here a reference is taken
by the ARP layer to the packet to avoid it being freed, but the Ethernet
immediately puts down the reference and send the ARP packet to the
driver.

If the ARP request fails for some reason, L2 returns failure to net_if
which then puts down the reference and the packet will be freed as the
reference count is now zero.

But the packet is still in the ARP's pending queue and after timeout
ARP will put down the reference causing double free bus fault (double
free message is only seen if the CONFIG_NET_PKT_LOG_LEVEL_DBG is
enabled, so, a bit hard to debug.

Fix this by clearing the ARP entry and pending queue after taking a
reference and then free ARP packet, IP packets are either freed by ARP
pending queue drain or net_if layer.

Signed-off-by: Krishna T <krishna.t@nordicsemi.no>
2023-02-20 19:45:28 +01:00
..
dsa
gptp
lldp
CMakeLists.txt
Kconfig
arp.c net: l2: ethernet: Fix double free 2023-02-20 19:45:28 +01:00
arp.h net: l2: ethernet: Fix double free 2023-02-20 19:45:28 +01:00
bridge.c
bridge.h
bridge_shell.c
eth_stats.h
ethernet.c net: l2: ethernet: Fix double free 2023-02-20 19:45:28 +01:00
ethernet_mgmt.c
ethernet_stats.c