* [PATCH] ipv4: fix lock leaks
@ 2022-01-21 3:11 ycaibb
2022-01-21 3:46 ` Jakub Kicinski
2022-01-21 3:47 ` Jakub Kicinski
0 siblings, 2 replies; 5+ messages in thread
From: ycaibb @ 2022-01-21 3:11 UTC (permalink / raw)
To: edumazet, davem, yoshfuji, dsahern, kuba, ast, daniel, andrii,
kafai, songliubraving, yhs, john.fastabend, kpsingh
Cc: netdev, linux-kernel, bpf, ycaibb
From: Ryan Cai <ycaibb@gmail.com>
In methods listening_get_first and listening_get_first in tcp_ipv4.c, there are lock leaks when seq_sk_match returns true.
Signed-off-by: Ryan Cai <ycaibb@gmail.com>
---
net/ipv4/tcp_ipv4.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 13d868c43284..714107766035 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -2329,6 +2329,7 @@ static void *listening_get_first(struct seq_file *seq)
inet_lhash2_for_each_icsk(icsk, &ilb2->head) {
sk = (struct sock *)icsk;
if (seq_sk_match(seq, sk))
+ spin_unlock(&ilb2->lock);
return sk;
}
spin_unlock(&ilb2->lock);
@@ -2407,6 +2408,7 @@ static void *established_get_first(struct seq_file *seq)
spin_lock_bh(lock);
sk_nulls_for_each(sk, node, &tcp_hashinfo.ehash[st->bucket].chain) {
if (seq_sk_match(seq, sk))
+ spin_unlock_bh(lock);
return sk;
}
spin_unlock_bh(lock);
--
2.33.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH] ipv4: fix lock leaks
2022-01-21 3:11 [PATCH] ipv4: fix lock leaks ycaibb
@ 2022-01-21 3:46 ` Jakub Kicinski
2022-01-21 3:47 ` Jakub Kicinski
1 sibling, 0 replies; 5+ messages in thread
From: Jakub Kicinski @ 2022-01-21 3:46 UTC (permalink / raw)
To: ycaibb
Cc: edumazet, davem, yoshfuji, dsahern, ast, daniel, andrii, kafai,
songliubraving, yhs, john.fastabend, kpsingh, netdev,
linux-kernel, bpf
On Fri, 21 Jan 2022 11:11:08 +0800 ycaibb wrote:
> From: Ryan Cai <ycaibb@gmail.com>
>
> In methods listening_get_first and listening_get_first in tcp_ipv4.c,
> there are lock leaks when seq_sk_match returns true.
This is on purpose, please read the code carefully and try to test
your patches.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] ipv4: fix lock leaks
2022-01-21 3:11 [PATCH] ipv4: fix lock leaks ycaibb
2022-01-21 3:46 ` Jakub Kicinski
@ 2022-01-21 3:47 ` Jakub Kicinski
2022-01-21 4:06 ` Ryan Cai
1 sibling, 1 reply; 5+ messages in thread
From: Jakub Kicinski @ 2022-01-21 3:47 UTC (permalink / raw)
To: ycaibb
Cc: edumazet, davem, yoshfuji, dsahern, ast, daniel, andrii, kafai,
songliubraving, yhs, john.fastabend, kpsingh, netdev,
linux-kernel, bpf
On Fri, 21 Jan 2022 11:11:08 +0800 ycaibb wrote:
> if (seq_sk_match(seq, sk))
> + spin_unlock_bh(lock);
> return sk;
Heh, also you're missing brackets so this is patently buggy.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] ipv4: fix lock leaks
2022-01-21 3:47 ` Jakub Kicinski
@ 2022-01-21 4:06 ` Ryan Cai
2022-01-21 4:11 ` Alexei Starovoitov
0 siblings, 1 reply; 5+ messages in thread
From: Ryan Cai @ 2022-01-21 4:06 UTC (permalink / raw)
To: Jakub Kicinski
Cc: edumazet, davem, yoshfuji, dsahern, ast, daniel, andrii, kafai,
songliubraving, yhs, john.fastabend, kpsingh, netdev,
linux-kernel, bpf
Sorry for reporting this false positive. Would be more careful next time. Thank you for your checking.
Best,
Ryan
On 21/1/2022, 11:47 AM, "Jakub Kicinski" <kuba@kernel.org> wrote:
On Fri, 21 Jan 2022 11:11:08 +0800 ycaibb wrote:
> if (seq_sk_match(seq, sk))
> + spin_unlock_bh(lock);
> return sk;
Heh, also you're missing brackets so this is patently buggy.
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] ipv4: fix lock leaks
2022-01-21 4:06 ` Ryan Cai
@ 2022-01-21 4:11 ` Alexei Starovoitov
0 siblings, 0 replies; 5+ messages in thread
From: Alexei Starovoitov @ 2022-01-21 4:11 UTC (permalink / raw)
To: Ryan Cai
Cc: Jakub Kicinski, Eric Dumazet, David S. Miller, Hideaki YOSHIFUJI,
David Ahern, Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend,
KP Singh, Network Development, LKML, bpf
On Thu, Jan 20, 2022 at 8:06 PM Ryan Cai <ycaibb@gmail.com> wrote:
>
> Sorry for reporting this false positive. Would be more careful next time. Thank you for your checking.
In the past 3 weeks you've sent 4 subtly broken patches.
Not a single valid one.
Are you trying to test the maintainer's review skills?
Is this another "lets hack the kernel" research project?
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-01-21 4:11 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-21 3:11 [PATCH] ipv4: fix lock leaks ycaibb
2022-01-21 3:46 ` Jakub Kicinski
2022-01-21 3:47 ` Jakub Kicinski
2022-01-21 4:06 ` Ryan Cai
2022-01-21 4:11 ` Alexei Starovoitov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox