summaryrefslogtreecommitdiff
path: root/drivers/net
diff options
context:
space:
mode:
authorEdward Cree <ecree@solarflare.com>2014-02-25 13:17:59 +0000
committerJiri Slaby <jslaby@suse.cz>2014-03-13 23:19:39 +0100
commit1c0267641d69bea415a8176de1ab996dfed3a510 (patch)
treecab7a688fcb0b338c2c0e7ac82d57a1a50703afe /drivers/net
parent3bbb02a1ba7a2ad0dbbd979ed715c9229b12e36a (diff)
sfc: check for NULL efx->ptp_data in efx_ptp_event
[ Upstream commit 8f355e5cee63c2c0c145d8206c4245d0189f47ff ] 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> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ethernet/sfc/ptp.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/net/ethernet/sfc/ptp.c b/drivers/net/ethernet/sfc/ptp.c
index 3dd39dcfe36b..a12410381cb1 100644
--- a/drivers/net/ethernet/sfc/ptp.c
+++ b/drivers/net/ethernet/sfc/ptp.c
@@ -1360,6 +1360,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;