Skip to contentSkip to conversation

net: cavium: fix NULL pointer dereference in cavium_ptp_put

PATCH Applied Jan Glauber 2 participants 2 messages Feb 12, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: cavium: fix NULL pointer dereference in cavium_ptp_put

Prevent a kernel panic on reboot if ptp_clock is NULL by checking the ptp pointer before using it.

Fixes 8c56df372bc1 ("net: add support for Cavium PTP coprocessor")
Cc Radoslaw Biernacki <[email protected]>
Cc Aleksey Makarov <[email protected]>
---
 drivers/net/ethernet/cavium/common/cavium_ptp.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/ethernet/cavium/common/cavium_ptp.c +2 -0
index c87c9c684a33..d59497a7bdce 100644
@@ -75,6 +75,8 @@ EXPORT_SYMBOL(cavium_ptp_get);
 
 void cavium_ptp_put(struct cavium_ptp *ptp)
 {
+	if (!ptp)
+		return;
 	pci_dev_put(ptp->pdev);
 }
 EXPORT_SYMBOL(cavium_ptp_put);
Signature · 1 line
2.16.1
maintainer Applied
#1 lore raw

From: Jan Glauber <[email protected]>
Date: Mon, 12 Feb 2018 18:20:11 +0100

Quoted 5 lines

Prevent a kernel panic on reboot if ptp_clock is NULL by checking the ptp pointer before using it.

Fixes 8c56df372bc1 ("net: add support for Cavium PTP coprocessor")

Applied, thank you.