Skip to content

Commit

Permalink
net: ethernet: bridge: Avoid null pointer access
Browse files Browse the repository at this point in the history
If the packet cloning failed, bail out in order to avoid
null pointer access.

Fixes #81992
Coverity-CID: 434493

Signed-off-by: Jukka Rissanen <[email protected]>
(cherry picked from commit ed0dcca)
  • Loading branch information
jukkar authored and github-actions[bot] committed Nov 28, 2024
1 parent 371e3a6 commit 04292a7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions subsys/net/l2/ethernet/bridge.c
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,11 @@ static enum net_verdict bridge_iface_process(struct net_if *iface,
*/
if (count > 2) {
send_pkt = net_pkt_clone(pkt, K_NO_WAIT);
if (send_pkt == NULL) {
NET_DBG("DROP: clone failed");
break;
}

net_pkt_ref(send_pkt);
} else {
send_pkt = net_pkt_ref(pkt);
Expand Down

0 comments on commit 04292a7

Please sign in to comment.