[Intel-wired-lan] [PATCH v5 net 2/7] i40e: avoid null ptr dereference in i40e_ptp_stop()

Mekala, SunithaX D sunithax.d.mekala at intel.com
Tue Sep 8 06:19:04 UTC 2026


> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces at osuosl.org> On Behalf Of Maciej Fijalkowski
> Sent: Wednesday, July 1, 2026 5:45 AM
> To: intel-wired-lan at lists.osuosl.org
> Cc: netdev at vger.kernel.org; Karlsson, Magnus <magnus.karlsson at intel.com>; kuba at kernel.org; pabeni at redhat.com; horms at kernel.org; Kitszel, Przemyslaw <przemyslaw.kitszel at intel.com>; Keller, Jacob E >  <jacob.e.keller at intel.com>; Fijalkowski, Maciej <maciej.fijalkowski at intel.com>; Sashiko AI Review <sashiko-bot at kernel.org>
> Subject: [Intel-wired-lan] [PATCH v5 net 2/7] i40e: avoid null ptr dereference in i40e_ptp_stop()
>
> Sashiko reports:
> ***
> If an allocation fails here during i40e_rebuild(), i40e_vsi_clear()
> frees the
> main VSI and sets pf->vsi[vsi->idx] = NULL, and the rebuild will abort
> without
> stopping the PTP clock.
> Later, if the device is removed or unbound, i40e_remove()
> unconditionally
> calls i40e_ptp_stop(), which does:
> drivers/net/ethernet/intel/i40e/i40e_ptp.c:i40e_ptp_stop() {
>     ...
>	struct i40e_vsi *main_vsi = i40e_pf_get_main_vsi(pf);
>     ...
>	dev_info(&pf->pdev->dev, "%s: removed PHC on %s\n", __func__,
>		 main_vsi->netdev->name);
>     ...
> }
> Would this cause a NULL pointer dereference since main_vsi is now NULL?
> ***
>
> Check if main_vsi is not null before calling dev_info().
>
> Fixes: beb0dff1251d ("i40e: enable PTP")
> Reported-by: Sashiko AI Review <sashiko-bot at kernel.org>
> Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski at intel.com>
> ---
>  drivers/net/ethernet/intel/i40e/i40e_ptp.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)

Tested-by: Sunitha Mekala <sunithax.d.mekala at intel.com> (A Contingent worker at Intel)


More information about the Intel-wired-lan mailing list