Skip to content

Commit 0e49f55

Browse files
jukkarnashif
authored andcommitted
net: tcp2: Check that connection exists in net_tcp_put()
Unit test tests/net/tcp2/net.tcp2.simple might have conn set to null so check it here. Signed-off-by: Jukka Rissanen <[email protected]>
1 parent ac7866c commit 0e49f55

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

subsys/net/ip/tcp2.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1436,6 +1436,10 @@ int net_tcp_put(struct net_context *context)
14361436
{
14371437
struct tcp *conn = context->tcp;
14381438

1439+
if (!conn) {
1440+
return -ENOENT;
1441+
}
1442+
14391443
k_mutex_lock(&conn->lock, K_FOREVER);
14401444

14411445
NET_DBG("%s", conn ? log_strdup(tcp_conn_state(conn, NULL)) : "");

0 commit comments

Comments
 (0)