summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorriastradh <riastradh@NetBSD.org>2022-08-20 14:05:22 +0000
committerriastradh <riastradh@NetBSD.org>2022-08-20 14:05:22 +0000
commitbd79f1766a2dea7bad14caa15eecd0197bc5b71d (patch)
tree2d0eaaec283f6123866b6c8e9e6b033d69dfa958
parentdf7d865e73e5a61096da790f7455943c696e675d (diff)
ifnet(9): On if_deactivate, don't make null if_slowtimo nonnull.
Fixes crash on detach.
-rw-r--r--sys/net/if.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/net/if.c b/sys/net/if.c
index 3e29f76c73d..664f3bd3b2d 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if.c,v 1.515 2022/08/20 12:42:51 riastradh Exp $ */
+/* $NetBSD: if.c,v 1.516 2022/08/20 14:05:22 riastradh 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.515 2022/08/20 12:42:51 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.516 2022/08/20 14:05:22 riastradh Exp $");
#if defined(_KERNEL_OPT)
#include "opt_inet.h"
@@ -1223,7 +1223,8 @@ if_deactivate(struct ifnet *ifp)
ifp->if_ioctl = if_nullioctl;
ifp->if_init = if_nullinit;
ifp->if_stop = if_nullstop;
- ifp->if_slowtimo = if_nullslowtimo;
+ if (ifp->if_slowtimo)
+ ifp->if_slowtimo = if_nullslowtimo;
ifp->if_drain = if_nulldrain;
/* No more packets may be enqueued. */