diff options
author | Edward Cree <ecree@solarflare.com> | 2014-02-25 13:17:59 (GMT) |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-02-26 20:22:02 (GMT) |
commit | 8f355e5cee63c2c0c145d8206c4245d0189f47ff (patch) | |
tree | c26bdef2e3dabe83e777bd34d7facff3786f43c3 /drivers | |
parent | 9a9bfd032f0207dd6e63c84b7676b58f160af04b (diff) | |
download | linux-8f355e5cee63c2c0c145d8206c4245d0189f47ff.tar.xz |
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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/ethernet/sfc/ptp.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/net/ethernet/sfc/ptp.c b/drivers/net/ethernet/sfc/ptp.c index eb75fbd..d7a3682 100644 --- a/drivers/net/ethernet/sfc/ptp.c +++ b/drivers/net/ethernet/sfc/ptp.c @@ -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; |