提交 8f355e5c 编写于 作者: E Edward Cree 提交者: David S. Miller

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: NEdward Cree <ecree@solarflare.com>
Acked-by: NShradha Shah <sshah@solarflare.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 9a9bfd03
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册