diff options
| author | Conrad Meyer <cem@FreeBSD.org> | 2019-10-23 16:48:22 +0000 |
|---|---|---|
| committer | Conrad Meyer <cem@FreeBSD.org> | 2019-10-23 16:48:22 +0000 |
| commit | 65366903c3a29331922b9a51df98c633064a600d (patch) | |
| tree | 4e4c6b31fee33bb955ea7631b279f05e131ee013 | |
| parent | de19b521ee22ff831650d9a9f96596511336ce0c (diff) | |
Prevent a panic when a driver provides bogus debugnet parameters
This is just a bandaid; we should fix the driver(s) too. Introduced in
r353685.
PR: 241403
X-MFC-With: r353685
Reported by: np and others
Notes
svn path=/head/; revision=353934
| -rw-r--r-- | sys/net/debugnet.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/sys/net/debugnet.c b/sys/net/debugnet.c index dcc6f85ac3e2..1090b2d3f4df 100644 --- a/sys/net/debugnet.c +++ b/sys/net/debugnet.c @@ -826,6 +826,15 @@ debugnet_any_ifnet_update(struct ifnet *ifp) nmbuf = ncl * (4 + nrxr); ncl *= nrxr; + /* + * Bandaid for drivers that (incorrectly) advertise LinkUp before their + * dn_init method is available. + */ + if (nmbuf == 0 || ncl == 0 || clsize == 0) { + printf("%s: Bad dn_init result from %s (ifp %p), ignoring.\n", + __func__, if_name(ifp), ifp); + return; + } dn_maybe_reinit_mbufs(nmbuf, ncl, clsize); } |
