linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [net] ptp: fix NULL pointer dereference in ptp_clock_register
@ 2021-07-05  8:53 Yangbo Lu
  2021-07-05 17:20 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Yangbo Lu @ 2021-07-05  8:53 UTC (permalink / raw)
  To: netdev
  Cc: Yangbo Lu, linux-kernel, Richard Cochran, David S . Miller,
	Rui Sousa, Sebastien Laveze

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")
Reported-by: kernel test robot <oliver.sang@intel.com>
Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
---
 drivers/ptp/ptp_clock.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/ptp/ptp_clock.c b/drivers/ptp/ptp_clock.c
index f012fa581cf4..ce6d9fc85607 100644
--- a/drivers/ptp/ptp_clock.c
+++ b/drivers/ptp/ptp_clock.c
@@ -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
-- 
2.25.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [net] ptp: fix NULL pointer dereference in ptp_clock_register
  2021-07-05  8:53 [net] ptp: fix NULL pointer dereference in ptp_clock_register Yangbo Lu
@ 2021-07-05 17:20 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-07-05 17:20 UTC (permalink / raw)
  To: Yangbo Lu
  Cc: netdev, linux-kernel, richardcochran, davem, rui.sousa, sebastien.laveze

Hello:

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

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")
> Reported-by: kernel test robot <oliver.sang@intel.com>
> Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
> 
> [...]

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



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-07-05 17:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-05  8:53 [net] ptp: fix NULL pointer dereference in ptp_clock_register Yangbo Lu
2021-07-05 17:20 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).