Module Name:    src
Committed By:   jdolecek
Date:           Tue May  5 09:52:13 UTC 2020

Modified Files:
        src/sys/arch/xen/xen: if_xennet_xenbus.c

Log Message:
due to the locking wild west for if_ioctl can't assert IFNET_LOCKED()
in xennet_ioctl(), so just do splnet() like other drivers do, and hope for best

fixes failed KASSERT() e.g. when starting rpcbind(), which ends
up calling this via sys_setsockopt()->sosetopt()->...->in6_addmulti()->
if_mcast_op(), this path doesn't currently take IFNET_LOCK()


To generate a diff of this commit:
cvs rdiff -u -r1.123 -r1.124 src/sys/arch/xen/xen/if_xennet_xenbus.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/arch/xen/xen/if_xennet_xenbus.c
diff -u src/sys/arch/xen/xen/if_xennet_xenbus.c:1.123 src/sys/arch/xen/xen/if_xennet_xenbus.c:1.124
--- src/sys/arch/xen/xen/if_xennet_xenbus.c:1.123	Mon May  4 10:03:45 2020
+++ src/sys/arch/xen/xen/if_xennet_xenbus.c	Tue May  5 09:52:13 2020
@@ -1,4 +1,4 @@
-/*      $NetBSD: if_xennet_xenbus.c,v 1.123 2020/05/04 10:03:45 jdolecek Exp $      */
+/*      $NetBSD: if_xennet_xenbus.c,v 1.124 2020/05/05 09:52:13 jdolecek Exp $      */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -81,10 +81,11 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.123 2020/05/04 10:03:45 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.124 2020/05/05 09:52:13 jdolecek Exp $");
 
 #include "opt_xen.h"
 #include "opt_nfs_boot.h"
+#include "opt_net_mpsafe.h"
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -1267,7 +1268,13 @@ xennet_ioctl(struct ifnet *ifp, u_long c
 #endif
 	int error = 0;
 
+#ifdef NET_MPSAFE
+#ifdef notyet
+	/* XXX IFNET_LOCK() is not taken in some cases e.g. multicast ioctls */
 	KASSERT(IFNET_LOCKED(ifp));
+#endif
+#endif
+	int s = splnet();
 
 	DPRINTFN(XEDB_FOLLOW, ("%s: xennet_ioctl()\n",
 	    device_xname(sc->sc_dev)));
@@ -1278,6 +1285,8 @@ xennet_ioctl(struct ifnet *ifp, u_long c
 	DPRINTFN(XEDB_FOLLOW, ("%s: xennet_ioctl() returning %d\n",
 	    device_xname(sc->sc_dev), error));
 
+	splx(s);
+
 	return error;
 }
 

Reply via email to