Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/usb usbnet: Assert IFNET_LOCKED in usbnet_media_upd.
details: https://anonhg.NetBSD.org/src/rev/32263407adc7
branches: trunk
changeset: 362496:32263407adc7
user: riastradh <riastradh%NetBSD.org@localhost>
date: Thu Mar 03 05:48:30 2022 +0000
description:
usbnet: Assert IFNET_LOCKED in usbnet_media_upd.
This ensures, if the device is being initialized or stopped,
usbnet_media_upd will not run until it's done, so the reset sequence
has exclusive access to the device registers used by mii.
diffstat:
sys/dev/usb/usbnet.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diffs (28 lines):
diff -r 78dddfe76e0f -r 32263407adc7 sys/dev/usb/usbnet.c
--- a/sys/dev/usb/usbnet.c Thu Mar 03 05:48:22 2022 +0000
+++ b/sys/dev/usb/usbnet.c Thu Mar 03 05:48:30 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: usbnet.c,v 1.56 2022/03/03 05:48:22 riastradh Exp $ */
+/* $NetBSD: usbnet.c,v 1.57 2022/03/03 05:48:30 riastradh Exp $ */
/*
* Copyright (c) 2019 Matthew R. Green
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.56 2022/03/03 05:48:22 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.57 2022/03/03 05:48:30 riastradh Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@@ -983,6 +983,9 @@
/* ifmedia layer ensures core_lock is held. */
usbnet_isowned_core(un);
+ /* ifmedia changes only with IFNET_LOCK held. */
+ KASSERTMSG(IFNET_LOCKED(ifp), "%s", ifp->if_xname);
+
if (unp->unp_dying)
return EIO;
Home |
Main Index |
Thread Index |
Old Index