Module Name:    src
Committed By:   yamaguchi
Date:           Tue Apr 13 04:53:22 UTC 2021

Modified Files:
        src/sys/net: if_pppoe.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.158 -r1.159 src/sys/net/if_pppoe.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/net/if_pppoe.c
diff -u src/sys/net/if_pppoe.c:1.158 src/sys/net/if_pppoe.c:1.159
--- src/sys/net/if_pppoe.c:1.158	Wed Nov 25 10:42:35 2020
+++ src/sys/net/if_pppoe.c	Tue Apr 13 04:53:22 2021
@@ -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);
 

Reply via email to