* [PATCH] net: cavium: fix NULL pointer dereference in cavium_ptp_put
@ 2018-02-12 17:20 Jan Glauber
2018-02-12 19:39 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Jan Glauber @ 2018-02-12 17:20 UTC (permalink / raw)
To: David S . Miller; +Cc: netdev, Jan Glauber, Radoslaw Biernacki, Aleksey Makarov
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@cavium.com>
Fixes: 8c56df372bc1 ("net: add support for Cavium PTP coprocessor")
Cc: Radoslaw Biernacki <rad@semihalf.com>
Cc: Aleksey Makarov <aleksey.makarov@cavium.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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] net: cavium: fix NULL pointer dereference in cavium_ptp_put
2018-02-12 17:20 [PATCH] net: cavium: fix NULL pointer dereference in cavium_ptp_put Jan Glauber
@ 2018-02-12 19:39 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2018-02-12 19:39 UTC (permalink / raw)
To: jglauber; +Cc: netdev, rad, aleksey.makarov
From: Jan Glauber <jglauber@cavium.com>
Date: Mon, 12 Feb 2018 18:20:11 +0100
> 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@cavium.com>
> Fixes: 8c56df372bc1 ("net: add support for Cavium PTP coprocessor")
Applied, thank you.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-02-12 19:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-12 17:20 [PATCH] net: cavium: fix NULL pointer dereference in cavium_ptp_put Jan Glauber
2018-02-12 19:39 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.