Skip to content

Commit

Permalink
net: ethernet: bridge: Drop the cloned packet in error
Browse files Browse the repository at this point in the history
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 <[email protected]>
(cherry picked from commit c6a1af5)
  • Loading branch information
jukkar authored and github-actions[bot] committed Nov 28, 2024
1 parent 04292a7 commit c4f2e2c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions subsys/net/l2/ethernet/bridge.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit c4f2e2c

Please sign in to comment.