diff options
author | Jan Glauber <jglauber@cavium.com> | 2018-02-12 18:20:11 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-02-12 14:38:37 -0500 |
commit | 07a2e1cf398187814b405665b19d36425ec7a962 (patch) | |
tree | d415d4b6dd9e61f2d679f82dfb9d521755e73427 /drivers/net | |
parent | 027d351c541744c0c780dd5801c63e4b90750b90 (diff) | |
download | linux-07a2e1cf398187814b405665b19d36425ec7a962.tar.bz2 |
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@cavium.com>
Fixes: 8c56df372bc1 ("net: add support for Cavium PTP coprocessor")
Cc: Radoslaw Biernacki <rad@semihalf.com>
Cc: Aleksey Makarov <aleksey.makarov@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/ethernet/cavium/common/cavium_ptp.c | 2 |
1 files changed, 2 insertions, 0 deletions
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); |