mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Verma, Vishal L" <vishal.l.verma@intel.com>
To: "Jiang, Dave" <dave.jiang@intel.com>,
	"Schofield, Alison" <alison.schofield@intel.com>,
	"bvanassche@acm.org" <bvanassche@acm.org>
Cc: "dan.j.williams@intel.com" <dan.j.williams@intel.com>,
	"linux-cxl@vger.kernel.org" <linux-cxl@vger.kernel.org>,
	"nvdimm@lists.linux.dev" <nvdimm@lists.linux.dev>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] dax/bus: Fix size_store() error path locking
Date: Mon, 30 Nov 2026 23:15:17 +0000	[thread overview]
Message-ID: <4752f2a175fe307d5b1e01c51c9582775dda363b.camel@intel.com> (raw)
In-Reply-To: <1c8cdb292623bfb846b1b8c7256a1002f7eedd6b.1795994997.git.bvanassche@acm.org>

On Sun, 2026-11-29 at 15:29 -0800, Bart Van Assche wrote:
> 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>

Reviewed-by: Vishal Verma <vishal.l.verma@intel.com>

> ---
>  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-30 23:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-29 23:29 Bart Van Assche
2026-11-30 23:15 ` Verma, Vishal L [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=4752f2a175fe307d5b1e01c51c9582775dda363b.camel@intel.com \
    --to=vishal.l.verma@intel.com \
    --cc=alison.schofield@intel.com \
    --cc=bvanassche@acm.org \
    --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 \
    /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®