From: Frederic Weisbecker <frederic@kernel.org>
To: Haoli Zhang <26031212468@stu.xidian.edu.cn>
Cc: tglx@kernel.org, anna-maria@linutronix.de,
linux-kernel@vger.kernel.org, richardcochran@gmail.com,
syzbot+667788430769ef9ddf25@syzkaller.appspotmail.com,
stable@vger.kernel.org, 25031212117@stu.xidian.edu.cn,
byu@xidian.edu.cn
Subject: Re: [PATCH] posix-clock: initialize cdev state before publishing
Date: Thu, 19 Nov 2026 17:29:06 +0100 [thread overview]
Message-ID: <av8j0vUFpUg2aZyf@localhost.localdomain> (raw)
In-Reply-To: <20261116032853.825-1-26031212468@stu.xidian.edu.cn>
Le Mon, Nov 16, 2026 at 11:28:53AM +0800, Haoli Zhang a écrit :
> cdev_device_add() may expose the cdev before it returns. Initialize
> clk->cdev.owner and clk->dev before calling it, so an open racing with
> registration takes the matching module and device references.
>
> If cdev_device_add() fails after cdev_add() made the cdev available,
> open files may still exist. Mark the clock as a zombie under rwsem before
> returning the error, so subsequent read, poll, ioctl, and dynamic clock
> operations on those files fail while the caller tears down registration
> state. Keep clk->dev valid so the release path can drop any reference
> acquired by a successful open.
Is the device made available before device_add()?
Thanks.
--
Frederic Weisbecker
SUSE Labs
prev parent reply other threads:[~2026-11-19 16:29 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 3:28 Haoli Zhang
2026-11-19 16:29 ` Frederic Weisbecker [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=av8j0vUFpUg2aZyf@localhost.localdomain \
--to=frederic@kernel.org \
--cc=25031212117@stu.xidian.edu.cn \
--cc=26031212468@stu.xidian.edu.cn \
--cc=anna-maria@linutronix.de \
--cc=byu@xidian.edu.cn \
--cc=linux-kernel@vger.kernel.org \
--cc=richardcochran@gmail.com \
--cc=stable@vger.kernel.org \
--cc=syzbot+667788430769ef9ddf25@syzkaller.appspotmail.com \
--cc=tglx@kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®