diff --git a/subsys/net/ip/net_if.c b/subsys/net/ip/net_if.c index 828e48ecf78..d431cbf1334 100644 --- a/subsys/net/ip/net_if.c +++ b/subsys/net/ip/net_if.c @@ -4145,12 +4145,15 @@ enum net_verdict net_if_recv_data(struct net_if *iface, struct net_pkt *pkt) /* L2 has modified the buffer starting point, it is easier * to re-initialize the cursor rather than updating it. */ - net_pkt_cursor_init(new_pkt); + if (new_pkt) { + net_pkt_cursor_init(new_pkt); - if (net_promisc_mode_input(new_pkt) == NET_DROP) { - net_pkt_unref(new_pkt); + if (net_promisc_mode_input(new_pkt) == NET_DROP) { + net_pkt_unref(new_pkt); + } + } else { + NET_WARN("promiscuous packet dropped, unable to clone packet"); } - net_pkt_unref(pkt); return verdict;