Skip to content

Commit ffd0a1f

Browse files
jukkarAnas Nashif
authored andcommitted
net: core: Check interface when receiving a packet
Although very unlikely, make sure that if the net_recv_data() is called with NULL network interface or packet, we recover that and return error to the caller. Signed-off-by: Jukka Rissanen <[email protected]>
1 parent 9287a9b commit ffd0a1f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

subsys/net/ip/net_core.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,8 +336,9 @@ static void net_queue_rx(struct net_if *iface, struct net_pkt *pkt)
336336
/* Called by driver when an IP packet has been received */
337337
int net_recv_data(struct net_if *iface, struct net_pkt *pkt)
338338
{
339-
NET_ASSERT(pkt && pkt->frags);
340-
NET_ASSERT(iface);
339+
if (!pkt || !iface) {
340+
return -EINVAL;
341+
}
341342

342343
if (!pkt->frags) {
343344
return -ENODATA;

0 commit comments

Comments
 (0)