From: Bart Van Assche <bvanassche@acm.org>
To: Vishal Verma <vishal.l.verma@intel.com>,
Dave Jiang <dave.jiang@intel.com>,
Alison Schofield <alison.schofield@intel.com>
Cc: nvdimm@lists.linux.dev, linux-cxl@vger.kernel.org,
linux-kernel@vger.kernel.org,
Bart Van Assche <bvanassche@acm.org>,
Dan Williams <dan.j.williams@intel.com>
Subject: [PATCH] dax/bus: Fix size_store() error path locking
Date: Sun, 29 Nov 2026 15:29:57 -0800 [thread overview]
Message-ID: <1c8cdb292623bfb846b1b8c7256a1002f7eedd6b.1795994997.git.bvanassche@acm.org> (raw)
If down_write_killable(&dax_dev_rwsem) fails, size_store() jumps to the
err_dev label and calls up_write(&dax_dev_rwsem) on a rwsem it does not
hold. Jump to err_region instead such that only dax_region_rwsem is
released on that error path. This locking bug was detected by the Clang
thread-safety analyzer.
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Vishal Verma <vishal.l.verma@intel.com>
Cc: Dave Jiang <dave.jiang@intel.com>
Cc: Alison Schofield <alison.schofield@intel.com>
Cc: nvdimm@lists.linux.dev
Cc: linux-cxl@vger.kernel.org
Fixes: c05ae9d85b47 ("dax/bus.c: replace driver-core lock usage by a local rwsem")
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/dax/bus.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/dax/bus.c b/drivers/dax/bus.c
index e40c25401cf0..fc83be5d6663 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);
reply other threads:[~2026-11-29 23:30 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1c8cdb292623bfb846b1b8c7256a1002f7eedd6b.1795994997.git.bvanassche@acm.org \
--to=bvanassche@acm.org \
--cc=alison.schofield@intel.com \
--cc=dan.j.williams@intel.com \
--cc=dave.jiang@intel.com \
--cc=linux-cxl@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nvdimm@lists.linux.dev \
--cc=vishal.l.verma@intel.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 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®