Source-Changes-HG archive

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

[src/trunk]: src/sys/net Hold the lock for pppoe while referencing sc_id



details:   https://anonhg.NetBSD.org/src/rev/4d4fe44e8e22
branches:  trunk
changeset: 1020469:4d4fe44e8e22
user:      yamaguchi <yamaguchi%NetBSD.org@localhost>
date:      Tue Apr 13 04:53:22 2021 +0000

description:
Hold the lock for pppoe while referencing sc_id
that is an item of struct pppoe_softc

diffstat:

 sys/net/if_pppoe.c |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (31 lines):

diff -r 5773af9b94e4 -r 4d4fe44e8e22 sys/net/if_pppoe.c
--- a/sys/net/if_pppoe.c        Tue Apr 13 04:52:00 2021 +0000
+++ b/sys/net/if_pppoe.c        Tue Apr 13 04:53:22 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_pppoe.c,v 1.158 2020/11/25 10:42:35 yamaguchi Exp $ */
+/* $NetBSD: if_pppoe.c,v 1.159 2021/04/13 04:53:22 yamaguchi Exp $ */
 
 /*
  * Copyright (c) 2002, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.158 2020/11/25 10:42:35 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.159 2021/04/13 04:53:22 yamaguchi Exp $");
 
 #ifdef _KERNEL_OPT
 #include "pppoe.h"
@@ -532,10 +532,11 @@
        memcpy(&t, token, len);
 
        LIST_FOREACH(sc, &pppoe_softc_list, sc_list) {
+               PPPOE_LOCK(sc, lock);
                if (sc->sc_id == t) {
-                       PPPOE_LOCK(sc, lock);
                        break;
                }
+               PPPOE_UNLOCK(sc);
        }
        rw_exit(&pppoe_softc_list_lock);
 



Home | Main Index | Thread Index | Old Index