lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1345387532.5158.222.camel@edumazet-glaptop>
Date:	Sun, 19 Aug 2012 16:45:32 +0200
From:	Eric Dumazet <eric.dumazet@...il.com>
To:	Lin Ming <mlin@...pku.edu.cn>
Cc:	Fengguang Wu <fengguang.wu@...el.com>,
	David Miller <davem@...emloft.net>,
	networking <netdev@...r.kernel.org>,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: IPv4 BUG: held lock freed!

On Sun, 2012-08-19 at 22:15 +0800, Lin Ming wrote:

> Will it still has problem if code goes here without sock_hold(sk)?

Not sure of what you mean.

At the time tcp_write_timer() runs, we own one reference on the socket.
(this reference was taken in sk_reset_timer())

On old kernels, if we found the socket locked by the user, we used to
rearm the timer for a 50ms delay (and thus did sock_hold() again)

Another way to avoid the bug would to make sure sk_reset_timer()
increases refcount _before_ setting the timer, but its adding one atomic
in fast path...

diff --git a/net/core/sock.c b/net/core/sock.c
index 8f67ced..d1745b7 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -2114,8 +2114,9 @@ EXPORT_SYMBOL(sk_send_sigurg);
 void sk_reset_timer(struct sock *sk, struct timer_list* timer,
 		    unsigned long expires)
 {
-	if (!mod_timer(timer, expires))
-		sock_hold(sk);
+	sock_hold(sk);
+	if (mod_timer(timer, expires))
+		__sock_put(sk);
 }
 EXPORT_SYMBOL(sk_reset_timer);
 


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ