Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/pci Add a KASSERT for the locking protocol in wm_ioctl.
details: https://anonhg.NetBSD.org/src/rev/bfe3e0d9769c
branches: trunk
changeset: 368763:bfe3e0d9769c
user: skrll <skrll%NetBSD.org@localhost>
date: Wed Aug 03 05:29:04 2022 +0000
description:
Add a KASSERT for the locking protocol in wm_ioctl.
Read the interface up/down status from sc_if_flags (under WM_CORE_LOCK)
when deciding if the multicast filter needs to be updated.
Discussed with msaitoh@, knakahara@ and riastradh@
diffstat:
sys/dev/pci/if_wm.c | 28 ++++++++++++++++++----------
1 files changed, 18 insertions(+), 10 deletions(-)
diffs (57 lines):
diff -r 0ed3b0eb794d -r bfe3e0d9769c sys/dev/pci/if_wm.c
--- a/sys/dev/pci/if_wm.c Wed Aug 03 05:23:30 2022 +0000
+++ b/sys/dev/pci/if_wm.c Wed Aug 03 05:29:04 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_wm.c,v 1.750 2022/08/03 05:23:30 skrll Exp $ */
+/* $NetBSD: if_wm.c,v 1.751 2022/08/03 05:29:04 skrll Exp $ */
/*
* Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -82,7 +82,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.750 2022/08/03 05:23:30 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.751 2022/08/03 05:29:04 skrll Exp $");
#ifdef _KERNEL_OPT
#include "opt_net_mpsafe.h"
@@ -3972,6 +3972,14 @@
DPRINTF(sc, WM_DEBUG_INIT, ("%s: %s called\n",
device_xname(sc->sc_dev), __func__));
+ switch (cmd) {
+ case SIOCADDMULTI:
+ case SIOCDELMULTI:
+ break;
+ default:
+ KASSERT(IFNET_LOCKED(ifp));
+ }
+
#ifndef WM_MPSAFE
s = splnet();
#endif
@@ -4040,15 +4048,15 @@
if (cmd == SIOCSIFCAP)
error = if_init(ifp);
- else if (cmd != SIOCADDMULTI && cmd != SIOCDELMULTI)
- ;
- else if (ifp->if_flags & IFF_RUNNING) {
- /*
- * Multicast list has changed; set the hardware filter
- * accordingly.
- */
+ else if (cmd == SIOCADDMULTI || cmd == SIOCDELMULTI) {
WM_CORE_LOCK(sc);
- wm_set_filter(sc);
+ if (sc->sc_if_flags & IFF_RUNNING) {
+ /*
+ * Multicast list has changed; set the hardware filter
+ * accordingly.
+ */
+ wm_set_filter(sc);
+ }
WM_CORE_UNLOCK(sc);
}
break;
Home |
Main Index |
Thread Index |
Old Index