Module Name: src Committed By: blymn Date: Thu Jul 1 22:08:13 UTC 2021
Modified Files: src/sys/kern: kern_pmf.c src/sys/net: if.c Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.46 -r1.47 src/sys/kern/kern_pmf.c cvs rdiff -u -r1.486 -r1.487 src/sys/net/if.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/kern/kern_pmf.c diff -u src/sys/kern/kern_pmf.c:1.46 src/sys/kern/kern_pmf.c:1.47 --- src/sys/kern/kern_pmf.c:1.46 Wed Jun 30 21:52:16 2021 +++ src/sys/kern/kern_pmf.c Thu Jul 1 22:08:13 2021 @@ -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 <jmcne...@invisible.ca> @@ -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; } Index: src/sys/net/if.c diff -u src/sys/net/if.c:1.486 src/sys/net/if.c:1.487 --- src/sys/net/if.c:1.486 Tue Jun 29 21:19:58 2021 +++ src/sys/net/if.c Thu Jul 1 22:08:13 2021 @@ -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);