Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/xen/xen due to the locking wild west for if_ioctl c...



details:   https://anonhg.NetBSD.org/src/rev/7c53122530dc
branches:  trunk
changeset: 1009854:7c53122530dc
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Tue May 05 09:52:13 2020 +0000

description:
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()

diffstat:

 sys/arch/xen/xen/if_xennet_xenbus.c |  13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diffs (45 lines):

diff -r c13dbe7868f8 -r 7c53122530dc sys/arch/xen/xen/if_xennet_xenbus.c
--- a/sys/arch/xen/xen/if_xennet_xenbus.c       Tue May 05 09:33:39 2020 +0000
+++ b/sys/arch/xen/xen/if_xennet_xenbus.c       Tue May 05 09:52:13 2020 +0000
@@ -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 @@
 #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 @@
        DPRINTFN(XEDB_FOLLOW, ("%s: xennet_ioctl() returning %d\n",
            device_xname(sc->sc_dev), error));
 
+       splx(s);
+
        return error;
 }
 



Home | Main Index | Thread Index | Old Index