Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/arm/sunxi Protect ether_multi list
details: https://anonhg.NetBSD.org/src/rev/df14e7bba811
branches: trunk
changeset: 998945:df14e7bba811
user: ozaki-r <ozaki-r%NetBSD.org@localhost>
date: Thu May 09 01:46:37 2019 +0000
description:
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
diffstat:
sys/arch/arm/sunxi/sunxi_emac.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diffs (34 lines):
diff -r fe5f150edf8b -r df14e7bba811 sys/arch/arm/sunxi/sunxi_emac.c
--- a/sys/arch/arm/sunxi/sunxi_emac.c Wed May 08 22:01:47 2019 +0000
+++ b/sys/arch/arm/sunxi/sunxi_emac.c Thu May 09 01:46:37 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_emac.c,v 1.25 2019/04/22 14:53:51 maya Exp $ */
+/* $NetBSD: sunxi_emac.c,v 1.26 2019/05/09 01:46:37 ozaki-r Exp $ */
/*-
* Copyright (c) 2016-2017 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -33,7 +33,7 @@
#include "opt_net_mpsafe.h"
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sunxi_emac.c,v 1.25 2019/04/22 14:53:51 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_emac.c,v 1.26 2019/05/09 01:46:37 ozaki-r Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -543,6 +543,7 @@
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);
@@ -553,6 +554,7 @@
hash[hashreg] |= (1 << hashbit);
ETHER_NEXT_MULTI(step, enm);
}
+ ETHER_UNLOCK(&sc->ec);
}
/* Write our unicast address */
Home |
Main Index |
Thread Index |
Old Index