From 55daa79ba38d73409d67a9ae2a43b781996e0cc3 Mon Sep 17 00:00:00 2001 From: Peter Bigot Date: Sun, 5 Apr 2020 11:38:39 -0500 Subject: [PATCH] net: context: fix return with held lock An internal early return left a mutex locked. See https://habr.com/en/company/pvs-studio/blog/495284/ fragment 15. Signed-off-by: Peter Bigot --- subsys/net/ip/net_context.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/subsys/net/ip/net_context.c b/subsys/net/ip/net_context.c index 7e33d0f4f31..de598bd6293 100644 --- a/subsys/net/ip/net_context.c +++ b/subsys/net/ip/net_context.c @@ -907,7 +907,8 @@ int net_context_connect(struct net_context *context, if (IS_ENABLED(CONFIG_NET_SOCKETS_PACKET) && addr->sa_family == AF_PACKET) { - return -EOPNOTSUPP; + ret = -EOPNOTSUPP; + goto unlock; } if (net_context_get_state(context) == NET_CONTEXT_LISTENING) {