Skip to content
Permalink
Browse files
ipv4: fix lock leaks
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>
  • Loading branch information
ycaibb authored and intel-lab-lkp committed Jan 21, 2022
1 parent 8aaaf2f commit 604258c8f5a9792828f54e55769ca1673c4a34ee
Showing 1 changed file with 2 additions and 0 deletions.
@@ -2340,6 +2340,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);
@@ -2418,6 +2419,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);

0 comments on commit 604258c

Please sign in to comment.