Module Name:    src
Committed By:   martin
Date:           Sun May 12 09:19:07 UTC 2019

Modified Files:
        src/sys/arch/arm/sunxi [netbsd-8]: sunxi_emac.c

Log Message:
Pull up following revision(s) (requested by ozaki-r in ticket #1259):

        sys/arch/arm/sunxi/sunxi_emac.c: revision 1.26

Protect ether_multi list

The list can be racy if NET_MPSAFE is enabled and the driver is executed without
KERNEL_LOCK.

Fix PR 54153


To generate a diff of this commit:
cvs rdiff -u -r1.4.4.4 -r1.4.4.5 src/sys/arch/arm/sunxi/sunxi_emac.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/arch/arm/sunxi/sunxi_emac.c
diff -u src/sys/arch/arm/sunxi/sunxi_emac.c:1.4.4.4 src/sys/arch/arm/sunxi/sunxi_emac.c:1.4.4.5
--- src/sys/arch/arm/sunxi/sunxi_emac.c:1.4.4.4	Tue Jan  2 10:20:32 2018
+++ src/sys/arch/arm/sunxi/sunxi_emac.c	Sun May 12 09:19:07 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_emac.c,v 1.4.4.4 2018/01/02 10:20:32 snj Exp $ */
+/* $NetBSD: sunxi_emac.c,v 1.4.4.5 2019/05/12 09:19:07 martin Exp $ */
 
 /*-
  * Copyright (c) 2016-2017 Jared McNeill <jmcne...@invisible.ca>
@@ -33,7 +33,7 @@
 #include "opt_net_mpsafe.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sunxi_emac.c,v 1.4.4.4 2018/01/02 10:20:32 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_emac.c,v 1.4.4.5 2019/05/12 09:19:07 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -548,6 +548,7 @@ sunxi_emac_setup_rxfilter(struct sunxi_e
 		hash[0] = hash[1] = ~0;
 	} else {
 		val |= HASH_MULTICAST;
+		ETHER_LOCK(&sc->ec);
 		ETHER_FIRST_MULTI(step, &sc->ec, enm);
 		while (enm != NULL) {
 			crc = ether_crc32_le(enm->enm_addrlo, ETHER_ADDR_LEN);
@@ -558,6 +559,7 @@ sunxi_emac_setup_rxfilter(struct sunxi_e
 			hash[hashreg] |= (1 << hashbit);
 			ETHER_NEXT_MULTI(step, enm);
 		}
+		ETHER_UNLOCK(&sc->ec);
 	}
 
 	/* Write our unicast address */

Reply via email to