[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180212172011.28854-1-jglauber@cavium.com>
Date: Mon, 12 Feb 2018 18:20:11 +0100
From: Jan Glauber <jglauber@...ium.com>
To: "David S . Miller" <davem@...emloft.net>
Cc: netdev@...r.kernel.org, Jan Glauber <jglauber@...ium.com>,
Radoslaw Biernacki <rad@...ihalf.com>,
Aleksey Makarov <aleksey.makarov@...ium.com>
Subject: [PATCH] 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.
Signed-off-by: Jan Glauber <jglauber@...ium.com>
Fixes: 8c56df372bc1 ("net: add support for Cavium PTP coprocessor")
Cc: Radoslaw Biernacki <rad@...ihalf.com>
Cc: Aleksey Makarov <aleksey.makarov@...ium.com>
---
drivers/net/ethernet/cavium/common/cavium_ptp.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/ethernet/cavium/common/cavium_ptp.c b/drivers/net/ethernet/cavium/common/cavium_ptp.c
index c87c9c684a33..d59497a7bdce 100644
--- a/drivers/net/ethernet/cavium/common/cavium_ptp.c
+++ b/drivers/net/ethernet/cavium/common/cavium_ptp.c
@@ -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);
--
2.16.1
Powered by blists - more mailing lists