Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 81f35ffd authored by Philipp Zabel's avatar Philipp Zabel Committed by David S. Miller
Browse files

net: fec: ptp: fix NULL pointer dereference if ptp_clock is not set



Since commit 278d2404 (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: default avatarPhilipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 9e7ceb06
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -1581,6 +1581,7 @@ fec_enet_interrupt(int irq, void *dev_id)
		complete(&fep->mdio_done);
		complete(&fep->mdio_done);
	}
	}


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


	return ret;
	return ret;