Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Back out fix for kern_pmf.c calling a null if_stop and a...
details: https://anonhg.NetBSD.org/src/rev/dbeea38ccc6e
branches: trunk
changeset: 380028:dbeea38ccc6e
user: blymn <blymn%NetBSD.org@localhost>
date: Thu Jul 01 22:08:13 2021 +0000
description:
Back out fix for kern_pmf.c calling a null if_stop and apply a fix
suggested by Jared McNeill which sets if_stop to a stub function
which means that more than just the pmf is protected from the NULL call.
diffstat:
sys/kern/kern_pmf.c | 21 +++++++--------------
sys/net/if.c | 10 ++++++----
2 files changed, 13 insertions(+), 18 deletions(-)
diffs (76 lines):
diff -r 735e28dfc1b2 -r dbeea38ccc6e sys/kern/kern_pmf.c
--- a/sys/kern/kern_pmf.c Thu Jul 01 20:39:15 2021 +0000
+++ b/sys/kern/kern_pmf.c Thu Jul 01 22:08:13 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_pmf.c,v 1.46 2021/06/30 21:52:16 blymn Exp $ */
+/* $NetBSD: kern_pmf.c,v 1.47 2021/07/01 22:08:13 blymn Exp $ */
/*-
* Copyright (c) 2007 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_pmf.c,v 1.46 2021/06/30 21:52:16 blymn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_pmf.c,v 1.47 2021/07/01 22:08:13 blymn Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -892,18 +892,11 @@ pmf_class_network_suspend(device_t dev,
struct ifnet *ifp = device_pmf_class_private(dev);
int s;
- if (ifp == NULL)
- return true;
-
- if ((*ifp->if_stop) == NULL)
- printf("device %s has no if_stop\n", ifp->if_xname);
- else {
- s = splnet();
- IFNET_LOCK(ifp);
- (*ifp->if_stop)(ifp, 0);
- IFNET_UNLOCK(ifp);
- splx(s);
- }
+ s = splnet();
+ IFNET_LOCK(ifp);
+ (*ifp->if_stop)(ifp, 0);
+ IFNET_UNLOCK(ifp);
+ splx(s);
return true;
}
diff -r 735e28dfc1b2 -r dbeea38ccc6e sys/net/if.c
--- a/sys/net/if.c Thu Jul 01 20:39:15 2021 +0000
+++ b/sys/net/if.c Thu Jul 01 22:08:13 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if.c,v 1.486 2021/06/29 21:19:58 riastradh Exp $ */
+/* $NetBSD: if.c,v 1.487 2021/07/01 22:08:13 blymn Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc.
@@ -90,7 +90,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.486 2021/06/29 21:19:58 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.487 2021/07/01 22:08:13 blymn Exp $");
#if defined(_KERNEL_OPT)
#include "opt_inet.h"
@@ -761,11 +761,13 @@ void
if_register(ifnet_t *ifp)
{
/*
- * If the driver has not supplied its own if_ioctl, then
- * supply the default.
+ * If the driver has not supplied its own if_ioctl or if_stop,
+ * then supply the default.
*/
if (ifp->if_ioctl == NULL)
ifp->if_ioctl = ifioctl_common;
+ if (ifp->if_stop == NULL)
+ ifp->if_stop = if_nullstop;
sysctl_sndq_setup(&ifp->if_sysctl_log, ifp->if_xname, &ifp->if_snd);
Home |
Main Index |
Thread Index |
Old Index