[PATCH v2 0/1][F] ptp: fix potential general protection fault in ptp_clock_unregister()

Andrea Righi andrea.righi at canonical.com
Fri Mar 27 10:07:05 UTC 2020

BugLink: https://bugs.launchpad.net/bugs/1864754

v2: move pps_unregister_source() to ptp_clock_release(), instead of
    posix_clock_unregister(), that would just introduce a resource leak


Disconnecting a thunderbolt docking station on a Dell Inc. XPS 13
9360/0D4J15 can cause a general protection fault (with kernel 5.3.0-40
and above).

The bug has been introduced by this upstream commit:

  ffe3bcaf02c4 ptp: fix the race between the release of ptp_clock and cdev

Reverting the commit is not a viable option, because we would
re-introduce another bug.

The proper fix is to do something similar to this:

  75718584cb3c64e6269109d4d54f888ac5a5fd15 "ptp: free ptp device pin descriptors properly"

and call pps_unregister_source() in ptp_clock_release(). NOTE: this bug
is also present upstream.

[Test case]

Bug reported provided the test case by physically disconnecting the
docking station. The problems can be easily reproduced and it doesn't
seem to happen anymore with the fix applied.


Call call pps_unregister_source() from ptp_clock_release() instead of

[Regression potential]

Minimal regression potential, the change is limited to the ptp clock
unregistering code path.

The following changes since commit 18e4e93f3f5cfbc918bce59299b81742b09ed7b5:

  UBUNTU: SAUCE: selftests/seccomp -- Disable timeout for seccomp tests (2020-03-26 16:13:17 +0100)

are available in the Git repository at:

  . cranky/master-next

for you to fetch changes up to 9036326e9f2770ba48ba02846ef5ec59ebaf5aae:

  UBUNTU: SAUCE: ptp: free ptp clock properly (2020-03-27 10:51:36 +0100)

Andrea Righi (1):
      UBUNTU: SAUCE: ptp: free ptp clock properly

 drivers/ptp/ptp_clock.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

More information about the kernel-team mailing list