Skip to content

Commit

Permalink
net: fec: ptp: fix NULL pointer dereference if ptp_clock is not set
Browse files Browse the repository at this point in the history
Since commit 278d240 (net: fec: ptp: Enable PPS output based on ptp clock)
fec_enet_interrupt calls fec_ptp_check_pps_event unconditionally, which calls
into ptp_clock_event. If fep->ptp_clock is NULL, ptp_clock_event tries to
dereference the NULL pointer.
Since on i.MX53 fep->bufdesc_ex is not set, fec_ptp_init is never called,
and fep->ptp_clock is NULL, which reliably causes a kernel panic.

This patch adds a check for fep->ptp_clock == NULL in fec_enet_interrupt.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Philipp Zabel authored and David S. Miller committed Oct 22, 2014
1 parent 9e7ceb0 commit 81f35ff
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/net/ethernet/freescale/fec_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1581,7 +1581,8 @@ fec_enet_interrupt(int irq, void *dev_id)
complete(&fep->mdio_done);
}

fec_ptp_check_pps_event(fep);
if (fep->ptp_clock)
fec_ptp_check_pps_event(fep);

return ret;
}
Expand Down

0 comments on commit 81f35ff

Please sign in to comment.