Skip to content

Commit

Permalink
sfc: check for NULL efx->ptp_data in efx_ptp_event
Browse files Browse the repository at this point in the history
If we receive a PTP event from the NIC when we haven't set up PTP state
in the driver, we attempt to read through a NULL pointer efx->ptp_data,
triggering a panic.

Signed-off-by: Edward Cree <ecree@solarflare.com>
Acked-by: Shradha Shah <sshah@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Edward Cree authored and David S. Miller committed Feb 26, 2014
1 parent 9a9bfd0 commit 8f355e5
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions drivers/net/ethernet/sfc/ptp.c
Original file line number Diff line number Diff line change
@@ -1668,6 +1668,13 @@ void efx_ptp_event(struct efx_nic *efx, efx_qword_t *ev)
struct efx_ptp_data *ptp = efx->ptp_data;
int code = EFX_QWORD_FIELD(*ev, MCDI_EVENT_CODE);

if (!ptp) {
if (net_ratelimit())
netif_warn(efx, drv, efx->net_dev,
"Received PTP event but PTP not set up\n");
return;
}

if (!ptp->enabled)
return;

0 comments on commit 8f355e5

Please sign in to comment.