Commit 55eac206 authored by Yangbo Lu's avatar Yangbo Lu Committed by David S. Miller

ptp: fix NULL pointer dereference in ptp_clock_register

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

Fixes: 73f37068 ("ptp: support ptp physical/virtual clocks conversion")
Reported-by: default avatarkernel test robot <oliver.sang@intel.com>
Signed-off-by: default avatarYangbo Lu <yangbo.lu@nxp.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 6ff63a15
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment