> -----Original Message-----
> From: Intel-wired-lan <[email protected]> On Behalf Of 
> Maciej Fijalkowski
> Sent: Wednesday, July 1, 2026 5:45 AM
> To: [email protected]
> Cc: [email protected]; Karlsson, Magnus <[email protected]>; 
> [email protected]; [email protected]; [email protected]; Kitszel, Przemyslaw 
> <[email protected]>; Keller, Jacob E >  
> <[email protected]>; Fijalkowski, Maciej 
> <[email protected]>; Sashiko AI Review <[email protected]>
> 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 <[email protected]>
> Signed-off-by: Maciej Fijalkowski <[email protected]>
> ---
>  drivers/net/ethernet/intel/i40e/i40e_ptp.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)

Tested-by: Sunitha Mekala <[email protected]> (A Contingent worker at 
Intel)

Reply via email to