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: 73f37068d5
("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>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
6ff63a150b
commit
55eac20617
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user