mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-23 17:30:02 +00:00
sfc: check for NULL efx->ptp_data in efx_ptp_event
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>
This commit is contained in:
parent
9a9bfd032f
commit
8f355e5cee
1 changed files with 7 additions and 0 deletions
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue