mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-10 11:40:19 -04:00
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: 8c56df372b ("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>
This commit is contained in:
committed by
David S. Miller
parent
027d351c54
commit
07a2e1cf39
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user