From: sashiko-bot@kernel.org
To: "Bart Van Assche" <bvanassche@acm.org>
Cc: nvdimm@lists.linux.dev, linux-cxl@vger.kernel.org
Subject: Re: [PATCH] dax/bus: Fix size_store() error path locking
Date: Sun, 29 Nov 2026 23:34:04 +0000 [thread overview]
Message-ID: <sashiko-outbox-240095@kernel.org> (raw)
In-Reply-To: <1c8cdb292623bfb846b1b8c7256a1002f7eedd6b.1795994997.git.bvanassche@acm.org>
Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [High] dax/bus: self-deadlock in __devm_create_dev_dax() [1]
--
commit 7b62e0aebcb009f3fd5163ad1f5b0fe4c39c45b9
Author: Bart Van Assche <bvanassche@acm.org>
dax/bus: Fix size_store() error path locking
This commit fixes the error path in size_store() when acquiring
dax_dev_rwsem fails so that it does not unlock dax_dev_rwsem without
holding it.
> diff --git a/drivers/dax/bus.c b/drivers/dax/bus.c
> index e40c25401cf06..fc83be5d6663c 100644
> --- a/drivers/dax/bus.c
> +++ b/drivers/dax/bus.c
> @@ -1129,11 +1129,10 @@ static ssize_t size_store(struct device *dev, struct device_attribute *attr,
> }
> rc = down_write_killable(&dax_dev_rwsem);
> if (rc)
> - goto err_dev;
> + goto err_region;
>
> rc = dev_dax_resize(dax_region, dev_dax, val);
>
> -err_dev:
> up_write(&dax_dev_rwsem);
> err_region:
> up_write(&dax_region_rwsem);
[Severity: High]
This problem wasn't introduced by this patch, but can
__devm_create_dev_dax() self-deadlock on dax_region_rwsem [1] when
devm_add_action_or_reset() fails?
Both devm_create_dev_dax() and create_store() hold dax_region_rwsem for
write while calling __devm_create_dev_dax():
drivers/dax/bus.c:__devm_create_dev_dax() {
...
rc = devm_add_action_or_reset(dax_region->dev, unregister_dev_dax, dev);
if (rc)
return ERR_PTR(rc);
...
}
If the devres allocation fails, devm_add_action_or_reset() synchronously
calls unregister_dev_dax(), which calls down_write(&dax_region_rwsem) and
deadlocks against the caller.
[1] https://sashiko.dev/#/bug/linux-be038c5a-8c27-4fcf-8ee1-010658394459
--
Sashiko AI review · https://sashiko.dev/#/patchset/1c8cdb292623bfb846b1b8c7256a1002f7eedd6b.1795994997.git.bvanassche@acm.org?part=1
prev parent reply other threads:[~2026-11-29 23:34 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-29 23:29 [PATCH] dax/bus: Fix size_store() error path locking Bart Van Assche
2026-11-29 23:34 ` sashiko-bot [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=sashiko-outbox-240095@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bvanassche@acm.org \
--cc=linux-cxl@vger.kernel.org \
--cc=nvdimm@lists.linux.dev \
--cc=sashiko-reviews@lists.linux.dev \
/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