diff options
| author | Edward Cree <ecree@solarflare.com> | 2014-02-25 08:17:59 -0500 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2014-02-26 15:22:02 -0500 |
| commit | 8f355e5cee63c2c0c145d8206c4245d0189f47ff (patch) | |
| tree | c26bdef2e3dabe83e777bd34d7facff3786f43c3 | |
| parent | 9a9bfd032f0207dd6e63c84b7676b58f160af04b (diff) | |
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>
| -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 eb75fbd11a01..d7a36829649a 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) | |||
| 1668 | struct efx_ptp_data *ptp = efx->ptp_data; | 1668 | struct efx_ptp_data *ptp = efx->ptp_data; |
| 1669 | int code = EFX_QWORD_FIELD(*ev, MCDI_EVENT_CODE); | 1669 | int code = EFX_QWORD_FIELD(*ev, MCDI_EVENT_CODE); |
| 1670 | 1670 | ||
| 1671 | if (!ptp) { | ||
| 1672 | if (net_ratelimit()) | ||
| 1673 | netif_warn(efx, drv, efx->net_dev, | ||
| 1674 | "Received PTP event but PTP not set up\n"); | ||
| 1675 | return; | ||
| 1676 | } | ||
| 1677 | |||
| 1671 | if (!ptp->enabled) | 1678 | if (!ptp->enabled) |
| 1672 | return; | 1679 | return; |
| 1673 | 1680 | ||
