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/23dc0a18c434
branches:  trunk
changeset: 378438:23dc0a18c434
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 9670f2367f7f -r 23dc0a18c434 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 @@ pppoe_find_softc_by_hunique(uint8_t *tok
        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