There is a bug in ptp_clock_unregister(), where ptp_cleanup_pin_groups()
first frees ptp->pin_{,dev_}attr, but then posix_clock_unregister() needs
them to destroy a related sysfs device.
These functions can not be just swapped, as posix_clock_unregister() frees
ptp which is needed in the ptp_cleanup_pin_groups(). Fix this by calling
ptp_cleanup_pin_groups() in ptp_clock_release(), right before ptp is freed.
This makes this patch fix an UAF bug in a patch which fixes an UAF bug.
Reported-by: Antti Laakso <antti.laakso@intel.com>
Fixes:
|
||
|---|---|---|
| .. | ||
| Kconfig | ||
| Makefile | ||
| idt8a340_reg.h | ||
| ptp_chardev.c | ||
| ptp_clock.c | ||
| ptp_clockmatrix.c | ||
| ptp_clockmatrix.h | ||
| ptp_dte.c | ||
| ptp_ixp46x.c | ||
| ptp_kvm.c | ||
| ptp_pch.c | ||
| ptp_private.h | ||
| ptp_qoriq.c | ||
| ptp_qoriq_debugfs.c | ||
| ptp_sysfs.c | ||