Skip to content

Commit

Permalink
net: cavium: fix NULL pointer dereference in cavium_ptp_put
Browse files Browse the repository at this point in the history
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: 8c56df3 ("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>
  • Loading branch information
Jan Glauber authored and David S. Miller committed Feb 12, 2018
1 parent 027d351 commit 07a2e1c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/net/ethernet/cavium/common/cavium_ptp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 07a2e1c

Please sign in to comment.