Source-Changes-HG archive

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

[src/trunk]: src/sys/net Avoid a race when the ifp->if_slowtimo pointer is ch...



details:   https://anonhg.NetBSD.org/src/rev/a513f7010d71
branches:  trunk
changeset: 334894:a513f7010d71
user:      martin <martin%NetBSD.org@localhost>
date:      Sun Dec 14 08:57:14 2014 +0000

description:
Avoid a race when the ifp->if_slowtimo pointer is changed while we are
running in if_slowtimo already. Suggested by Masao Uebayashi
in PR kern/49462.

diffstat:

 sys/net/if.c |  10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diffs (38 lines):

diff -r dca6cf676d96 -r a513f7010d71 sys/net/if.c
--- a/sys/net/if.c      Sun Dec 14 01:13:57 2014 +0000
+++ b/sys/net/if.c      Sun Dec 14 08:57:14 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if.c,v 1.305 2014/12/11 14:33:22 martin Exp $  */
+/*     $NetBSD: if.c,v 1.306 2014/12/14 08:57:14 martin Exp $  */
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc.
@@ -90,7 +90,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.305 2014/12/11 14:33:22 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.306 2014/12/14 08:57:14 martin Exp $");
 
 #include "opt_inet.h"
 
@@ -1515,15 +1515,17 @@
 static void
 if_slowtimo(void *arg)
 {
+       void (*slowtimo)(struct ifnet *);
        struct ifnet *ifp = arg;
        int s;
 
-       if (__predict_false(ifp->if_slowtimo == NULL))
+       slowtimo = ifp->if_slowtimo;
+       if (__predict_false(slowtimo == NULL))
                return;
 
        s = splnet();
        if (ifp->if_timer != 0 && --ifp->if_timer == 0)
-               (*ifp->if_slowtimo)(ifp);
+               (*slowtimo)(ifp);
 
        splx(s);
 



Home | Main Index | Thread Index | Old Index