From aa16e187246c1561b329361b2f507e1c14fcc8a5 Mon Sep 17 00:00:00 2001 From: jdolecek Date: Tue, 5 May 2020 09:22:24 +0000 Subject: [PATCH] add a NOMPSAFE comment for if_mcast_op(), it is called from context which doesn't hold IFNET_LOCK() in some cases, and calls if_ioctl this needs to be sorted out for NET_MPSAFE --- sys/net/if.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sys/net/if.c b/sys/net/if.c index 3229f52a1b4e..7407414c94b0 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -1,4 +1,4 @@ -/* $NetBSD: if.c,v 1.475 2020/05/05 08:05:03 jdolecek Exp $ */ +/* $NetBSD: if.c,v 1.476 2020/05/05 09:22:24 jdolecek Exp $ */ /*- * Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc. @@ -90,7 +90,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.475 2020/05/05 08:05:03 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.476 2020/05/05 09:22:24 jdolecek Exp $"); #if defined(_KERNEL_OPT) #include "opt_inet.h" @@ -3791,6 +3791,11 @@ if_mcast_op(ifnet_t *ifp, const unsigned long cmd, const struct sockaddr *sa) int rc; struct ifreq ifr; + /* + * XXX NOMPSAFE - this calls if_ioctl without holding IFNET_LOCK() + * in some cases - e.g. when called from vlan/netinet/netinet6 code + * directly rather than via sockopt/doifoictl() + */ ifreq_setaddr(cmd, &ifr, sa); rc = (*ifp->if_ioctl)(ifp, cmd, &ifr);