From: Thomas Gleixner <tglx@linutronix.de>
To: fangsz <315539811@qq.com>, anna-maria@linutronix.de, frederic@kernel.org
Cc: linux-kernel@vger.kernel.org, richardcochran@gmail.com
Subject: Re: [PATCH] posix-clock: bind the device before the cdev is published
Date: Mon, 09 Nov 2026 17:37:44 +0100 [thread overview]
Message-ID: <87bj7yufjb.ffs@fw13> (raw)
In-Reply-To: <tencent_D7A5991BA49FFDC9706385B0D2BED254EF06@qq.com>
On Tue, Oct 27 2026 at 01:18, fangsz wrote:
>
> The window is small, but it is hit in practice once a driver registers
> and unregisters the PTP clock repeatedly, for example on every link up
> and down, while ptp4l keeps reopening the node:
>
> [ 50.048138] eth0: registered PTP clock
> [ 50.767426] ptp4l: refcount_t: underflow; use-after-free.
> [ 55.735110] eth0: Link is Down
> [ 55.816736] eth0: registered PTP clock
>
> The ordering was introduced by a33121e5487b, which added the
> get_device()/put_device() pair around clk->dev but left the assignment
> at the end of posix_clock_register(). Bind clk->dev before the character
> device is published and clear it again when cdev_device_add() fails, so
> that an open() racing with the registration always finds a valid device
> to take a reference on.
>
> Fixes: a33121e5487b ("ptp: fix the race between the release of ptp_clock and cdev")
> Cc: stable@vger.kernel.org
> Signed-off-by: fangsz <315539811@qq.com>
'fagnsz ' does not qualify as a proper name identifying you. See
Documentation/process/
Also please analyze and address:
https://sashiko.dev/#/patchset/tencent_D7A5991BA49FFDC9706385B0D2BED254EF06@qq.com
Thanks,
tglx
prev parent reply other threads:[~2026-11-09 16:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-26 17:18 [PATCH] posix-clock: bind the device before the cdev is published fangsz
2026-10-28 14:25 ` Frederic Weisbecker
2026-11-09 16:37 ` Thomas Gleixner [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87bj7yufjb.ffs@fw13 \
--to=tglx@linutronix.de \
--cc=315539811@qq.com \
--cc=anna-maria@linutronix.de \
--cc=frederic@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=richardcochran@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.