[Bug 248046] Panic when creating a bridge interface
bugzilla-noreply at freebsd.org
bugzilla-noreply at freebsd.org
Fri Jul 17 16:56:46 UTC 2020
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=248046
--- Comment #1 from Kristof Provost <kp at 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 = buflen;
return (0);
}
- BRIDGE_UNLOCK(sc);
- outbuf = malloc(buflen, M_TEMP, M_WAITOK | M_ZERO);
- BRIDGE_LOCK(sc);
+ outbuf = malloc(buflen, M_TEMP, M_NOWAIT | M_ZERO);
+ if (outbuf == NULL)
+ return (ENOMEM);
count = 0;
buf = outbuf;
@@ -1455,9 +1455,9 @@ bridge_ioctl_rts(struct bridge_softc *sc, void *arg)
count++;
buflen = sizeof(bareq) * count;
- BRIDGE_UNLOCK(sc);
- outbuf = malloc(buflen, M_TEMP, M_WAITOK | M_ZERO);
- BRIDGE_LOCK(sc);
+ outbuf = malloc(buflen, M_TEMP, M_NOWAIT | M_ZERO);
+ if (outbuf == NULL)
+ return (ENOMEM);
count = 0;
buf = outbuf;
@@ -1783,9 +1783,9 @@ bridge_ioctl_gifsstp(struct bridge_softc *sc, void *arg)
return (0);
}
- BRIDGE_UNLOCK(sc);
- outbuf = malloc(buflen, M_TEMP, M_WAITOK | M_ZERO);
- BRIDGE_LOCK(sc);
+ outbuf = malloc(buflen, M_TEMP, M_NOWAIT | M_ZERO);
+ if (outbuf == NULL)
+ return (ENOMEM);
count = 0;
buf = outbuf;
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the freebsd-net
mailing list