net: ethernet: bridge: Drop the cloned packet in error

We need to drop the cloned packet that was fed to the bridge instead of
returning directly from the function. Without this change we have a
buffer leak.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
This commit is contained in:
Jukka Rissanen 2024-11-26 13:25:52 +02:00 committed by Benjamin Cabé
commit c6a1af5c17

View file

@ -345,7 +345,7 @@ static enum net_verdict bridge_iface_process(struct net_if *iface,
/* Drop all link-local packets for now. */
if (is_link_local_addr((struct net_eth_addr *)net_pkt_lladdr_dst(pkt))) {
NET_DBG("DROP: lladdr");
return NET_DROP;
goto out;
}
lock_bridge(ctx);
@ -397,11 +397,11 @@ static enum net_verdict bridge_iface_process(struct net_if *iface,
unlock_bridge(ctx);
out:
/* The packet was cloned by the caller so remove it here. */
net_pkt_unref(pkt);
return NET_OK;
}
int bridge_iface_send(struct net_if *iface, struct net_pkt *pkt)