From e6d3eda9dd0139dcafa2ffcc1df48cdb38f24f4f Mon Sep 17 00:00:00 2001 From: wangchen Date: Mon, 22 Jul 2024 16:05:37 +0800 Subject: [PATCH] icmp:add net_lock to protect icmp connection Signed-off-by: wangchen --- net/icmp/icmp_sockif.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/icmp/icmp_sockif.c b/net/icmp/icmp_sockif.c index 146ec2e7091cb..3334096152f61 100644 --- a/net/icmp/icmp_sockif.c +++ b/net/icmp/icmp_sockif.c @@ -254,6 +254,7 @@ static int icmp_close(FAR struct socket *psock) { FAR struct icmp_conn_s *conn; + net_lock(); conn = psock->s_conn; /* Is this the last reference to the connection structure (there could be\ @@ -280,6 +281,7 @@ static int icmp_close(FAR struct socket *psock) conn->crefs--; } + net_unlock(); return OK; }