All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC] net: Replace del_timer() with del_timer_sync()
@ 2014-08-07  6:18 Deepak
  2014-08-07  6:55 ` Eric Dumazet
  0 siblings, 1 reply; 5+ messages in thread
From: Deepak @ 2014-08-07  6:18 UTC (permalink / raw)
  To: davem, netdev; +Cc: linux-kernel

     on SMP system, del_timer() might return even if the timer function
     is running on other cpu so sk_stop_timer() will execute __sock_put()
     while timer is accessing the socket on other cpu causing 
"use-after-free".

     This commit replaces del_timer() with del_timer_sync() in 
sk_stop_timer().
     del_timer_sync() will wait untill the timer function is not running in
     any other cpu hence making sk_stop_timer() SMP safe.

     Signed-off-by: Deepak Das <deepak_das@mentor.com>

diff --git a/net/core/sock.c b/net/core/sock.c
index 026e01f..491a84d 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -2304,7 +2304,7 @@ EXPORT_SYMBOL(sk_reset_timer);

  void sk_stop_timer(struct sock *sk, struct timer_list* timer)
  {
-       if (del_timer(timer))
+       if (del_timer_sync(timer))
                 __sock_put(sk);
  }
  EXPORT_SYMBOL(sk_stop_timer);

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-08-11 10:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-07  6:18 [RFC] net: Replace del_timer() with del_timer_sync() Deepak
2014-08-07  6:55 ` Eric Dumazet
2014-08-07 15:15   ` Das, Deepak
2014-08-07 16:48     ` Eric Dumazet
2014-08-11 10:25       ` Deepak

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.