Subject: Re: [PATCH v3 1/1] net: core: prevent NULL deref in generic_hwtstamp_ioctl_lower()

From: Jakub Kicinski <[email-masked]>
Date: Mon, 3 Nov 2025 17:15:57 -0800

On Thu, 30 Oct 2025 12:49:47 +0000 Jiaming Zhang wrote:
> +	/* Netlink path with unconverted lower driver */
> +	if (!kernel_cfg->ifr)
> +		return -EOPNOTSUPP;
> +
>  	/* Legacy path: unconverted lower driver */
>  	return generic_hwtstamp_ioctl_lower(dev, SIOCGHWTSTAMP, kernel_cfg);
>  }
> @@ -498,6 +502,10 @@ int generic_hwtstamp_set_lower(struct net_device *dev,
>  		return err;
>  	}
>  
> +	/* Netlink path with unconverted lower driver */
> +	if (!kernel_cfg->ifr)
> +		return -EOPNOTSUPP;
> +
>  	/* Legacy path: unconverted lower driver */
>  	return generic_hwtstamp_ioctl_lower(dev, SIOCSHWTSTAMP, kernel_cfg);

Sorry but nit:

instead of adding this to both callers you can add the check in
generic_hwtstamp_ioctl_lower().
-- 
pw-bot: cr