From: Alison Schofield <alison.schofield@intel.com>
To: <jianyungao89@gmail.com>
Cc: <linux-kernel@vger.kernel.org>, Dan Williams <djbw@kernel.org>,
"Vishal Verma" <vishal.l.verma@intel.com>,
Dave Jiang <dave.jiang@intel.com>,
"open list:DEVICE DIRECT ACCESS (DAX)" <nvdimm@lists.linux.dev>,
"open list:DEVICE DIRECT ACCESS (DAX)"
<linux-cxl@vger.kernel.org>
Subject: Re: [PATCH] dax: fix mapping_store() returning 0 instead of error code
Date: Mon, 12 Oct 2026 16:21:45 -0700 [thread overview]
Message-ID: <as1riZMcDaX5niW9@aschofie-mobl2.lan> (raw)
In-Reply-To: <20261011131857.30481-1-jianyungao89@gmail.com>
On Sun, Oct 11, 2026 at 09:18:57PM +0800, jianyungao89@gmail.com wrote:
> From: Jianyun Gao <jianyungao89@gmail.com>
>
> When the region driver is not loaded, mapping_store() returns rc
> which is 0 at that point, instead of an error code. Set it to
> -ENXIO to match the equivalent check in size_store().
Hi Jianyun,
The change looks correct, but there is another path in mapping_store() with
the same problem. When alloc_is_aligned() fails, rc is still zero, so the
sysfs write reports success without allocating the requested range.
Muchun Song already posted a patch addressing both cases.
https://lore.kernel.org/nvdimm/20260924025035.1265035-1-songmuchun@bytedance.com/
Please take a look and add your reviewed-by tag to Muchun's patchset
or comment if it doesn't meet your needs.
-- Alison
>
> Fixes: 9567da0b408a ("device-dax: Introduce bus + driver model")
> Signed-off-by: Jianyun Gao <jianyungao89@gmail.com>
> ---
> drivers/dax/bus.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/dax/bus.c b/drivers/dax/bus.c
> index b809e1a264af..262f97b5e7aa 100644
> --- a/drivers/dax/bus.c
> +++ b/drivers/dax/bus.c
> @@ -1192,7 +1192,7 @@ static ssize_t mapping_store(struct device *dev, struct device_attribute *attr,
> return rc;
> if (!dax_region->dev->driver) {
> up_write(&dax_region_rwsem);
> - return rc;
> + return -ENXIO;
> }
> rc = down_write_killable(&dax_dev_rwsem);
> if (rc) {
> --
> 2.34.1
>
next prev parent reply other threads:[~2026-10-12 23:21 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-11 13:18 jianyungao89
2026-10-12 14:48 ` Jonathan Cameron
2026-10-12 23:21 ` Alison Schofield [this message]
2026-10-13 1:55 ` Jianyun Gao
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=as1riZMcDaX5niW9@aschofie-mobl2.lan \
--to=alison.schofield@intel.com \
--cc=dave.jiang@intel.com \
--cc=djbw@kernel.org \
--cc=jianyungao89@gmail.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®