Skip to contentSkip to conversation

ptp: fix NULL pointer dereference in ptp_clock_register

net Applied Yangbo Lu 2 participants 2 messages Jul 5, 2021

Subsystems (3)
lore
Share & tools
lore

Yangbo Lu

author
#0 lore raw

Fix NULL pointer dereference in ptp_clock_register. The argument "parent" of ptp_clock_register may be NULL pointer.

Fixes 73f37068d540 ("ptp: support ptp physical/virtual clocks conversion")
---
 drivers/ptp/ptp_clock.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ptp/ptp_clock.c +1 -1
index f012fa581cf4..ce6d9fc85607 100644
@@ -236,7 +236,7 @@ struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info,
 	}
 
 	/* PTP virtual clock is being registered under physical clock */
-	if (parent->class && parent->class->name &&
+	if (parent && parent->class && parent->class->name &&
 	    strcmp(parent->class->name, "ptp") == 0)
 		ptp->is_virtual_clock = true;
 

base-commit: 6ff63a150b5556012589ae59efac1b5eeb7d32c3

Signature · 1 line
2.25.1
#1 lore raw
This patch was applied to netdev/net.git (refs/heads/master):

Hello:

This patch was applied to netdev/net.git (refs/heads/master):

Quoted 8 lines · On Mon, 5 Jul 2021 16:53:06 +0800 you wrote:

Fix NULL pointer dereference in ptp_clock_register. The argument "parent" of ptp_clock_register may be NULL pointer.

Fixes 73f37068d540 ("ptp: support ptp physical/virtual clocks conversion")

[...]

Here is the summary with links:
- [net] ptp: fix NULL pointer dereference in ptp_clock_register

    https://git.kernel.org/netdev/net/c/55eac20617ca

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html