bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: ycaibb <ycaibb@gmail.com>
To: davem@davemloft.net, yoshfuji@linux-ipv6.org, dsahern@kernel.org,
	kuba@kernel.org, ast@kernel.org, daniel@iogearbox.net,
	andrii@kernel.org, kafai@fb.com, songliubraving@fb.com,
	yhs@fb.com, john.fastabend@gmail.com, kpsingh@kernel.org
Cc: netdev@vger.kernel.org, ycaibb@gmail.com,
	linux-kernel@vger.kernel.org, bpf@vger.kernel.org
Subject: [PATCH] inet: missing lock releases in udp.c
Date: Fri, 21 Jan 2022 11:15:53 +0800	[thread overview]
Message-ID: <20220121031553.5342-1-ycaibb@gmail.com> (raw)

From: Ryan Cai <ycaibb@gmail.com>

In method udp_get_first, the lock hslot->lock is not released when afinfo->family == AF_UNSPEC || sk->sk_family == afinfo->family is true. This patch fixes the problem by adding the unlock statement.

Signed-off-by: Ryan Cai <ycaibb@gmail.com>
---
 net/ipv4/udp.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 23b05e28490b..f7d573ecaafb 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -2967,6 +2967,7 @@ static struct sock *udp_get_first(struct seq_file *seq, int start)
 				continue;
 			if (afinfo->family == AF_UNSPEC ||
 			    sk->sk_family == afinfo->family)
+				spin_unlock_bh(&hslot->lock);
 				goto found;
 		}
 		spin_unlock_bh(&hslot->lock);
-- 
2.33.0


             reply	other threads:[~2022-01-21  3:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-21  3:15 ycaibb [this message]
2022-01-23 19:57 ` [PATCH] inet: missing lock releases in udp.c Cong Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220121031553.5342-1-ycaibb@gmail.com \
    --to=ycaibb@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=john.fastabend@gmail.com \
    --cc=kafai@fb.com \
    --cc=kpsingh@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=songliubraving@fb.com \
    --cc=yhs@fb.com \
    --cc=yoshfuji@linux-ipv6.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).