netdump: Check the return value of ifunit_ref()

We may fail to match if the specific interface doesn't exist or was
renamed.

PR:		273715
Reported by:	grembo
MFC after:	1 week
This commit is contained in:
Mark Johnston 2023-10-02 08:08:20 -04:00
parent e61568aeee
commit d94d07d581
1 changed files with 2 additions and 0 deletions

View File

@ -451,6 +451,8 @@ netdump_configure(struct diocskerneldump_arg *conf, struct thread *td)
CURVNET_SET(vnet0);
ifp = ifunit_ref(conf->kda_iface);
CURVNET_RESTORE();
if (ifp == NULL)
return (ENODEV);
if (!DEBUGNET_SUPPORTED_NIC(ifp)) {
if_rele(ifp);
return (ENODEV);