Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 17 Jul 2020 16:56:46 +0000
From:      bugzilla-noreply@freebsd.org
To:        net@FreeBSD.org
Subject:   [Bug 248046] Panic when creating a bridge interface
Message-ID:  <bug-248046-7501-Bg6s42v8PL@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-248046-7501@https.bugs.freebsd.org/bugzilla/>
References:  <bug-248046-7501@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D248046

--- Comment #1 from Kristof Provost <kp@freebsd.org> ---
That seems fairly straightforward.
The only odd thing is that this doesn't trigger panics on current. It looks
like epoch is a bit more tolerant of sleeps there.

Still, it looks to be easy to avoid the malloc(M_WAITOK), so let's just do =
that
everywhere.

I'm testing this patch now:

diff --git a/sys/net/if_bridge.c b/sys/net/if_bridge.c
index 19d8d8964d9..51ee9d29906 100644
--- a/sys/net/if_bridge.c
+++ b/sys/net/if_bridge.c
@@ -1393,9 +1393,9 @@ bridge_ioctl_gifs(struct bridge_softc *sc, void *arg)
                bifc->ifbic_len =3D buflen;
                return (0);
        }
-       BRIDGE_UNLOCK(sc);
-       outbuf =3D malloc(buflen, M_TEMP, M_WAITOK | M_ZERO);
-       BRIDGE_LOCK(sc);
+       outbuf =3D malloc(buflen, M_TEMP, M_NOWAIT | M_ZERO);
+       if (outbuf =3D=3D NULL)
+               return (ENOMEM);

        count =3D 0;
        buf =3D outbuf;
@@ -1455,9 +1455,9 @@ bridge_ioctl_rts(struct bridge_softc *sc, void *arg)
                count++;
        buflen =3D sizeof(bareq) * count;

-       BRIDGE_UNLOCK(sc);
-       outbuf =3D malloc(buflen, M_TEMP, M_WAITOK | M_ZERO);
-       BRIDGE_LOCK(sc);
+       outbuf =3D malloc(buflen, M_TEMP, M_NOWAIT | M_ZERO);
+       if (outbuf =3D=3D NULL)
+               return (ENOMEM);

        count =3D 0;
        buf =3D outbuf;
@@ -1783,9 +1783,9 @@ bridge_ioctl_gifsstp(struct bridge_softc *sc, void *a=
rg)
                return (0);
        }

-       BRIDGE_UNLOCK(sc);
-       outbuf =3D malloc(buflen, M_TEMP, M_WAITOK | M_ZERO);
-       BRIDGE_LOCK(sc);
+       outbuf =3D malloc(buflen, M_TEMP, M_NOWAIT | M_ZERO);
+       if (outbuf =3D=3D NULL)
+               return (ENOMEM);

        count =3D 0;
        buf =3D outbuf;

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-248046-7501-Bg6s42v8PL>