[PATCH] ipv4: fix lock leaks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Ryan Cai <ycaibb@xxxxxxxxx>

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@xxxxxxxxx>
---
 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




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux