Linux CXL
 help / color / mirror / Atom feed
From: Dave Jiang <dave.jiang@intel.com>
To: Alison Schofield <alison.schofield@intel.com>,
	Davidlohr Bueso <dave@stgolabs.net>,
	Jonathan Cameron <jic23@kernel.org>,
	Vishal Verma <vishal.l.verma@intel.com>,
	Ira Weiny <iweiny@kernel.org>, Li Ming <ming.li@zohomail.com>
Cc: linux-cxl@vger.kernel.org,
	Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
Subject: Re: [PATCH v3 1/2] cxl/region: Fix use-after-free in find_pos_and_ways() error path
Date: Fri, 24 Jul 2026 15:48:19 -0700	[thread overview]
Message-ID: <58edcca8-2a28-45fe-b5f8-87b08d22e82a@intel.com> (raw)
In-Reply-To: <10deb519b543ef693ce23148b509a03fe1c07d0c.1784931354.git.alison.schofield@intel.com>



On 7/24/26 3:28 PM, Alison Schofield wrote:
> The error path releases its reference to a switch decoder before
> logging an error that includes the decoder name. If the released
> reference is the last one, the decoder can be freed before the error
> message accesses its name.
> 
> Drop the reference after the error is reported.
> 
> Fixes: d90acdf49e18 ("cxl/region: Add a dev_err() on missing target list entries")
> Reviewed-by: Li Ming <ming.li@zohomail.com>
> Reviewed-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
> Signed-off-by: Alison Schofield <alison.schofield@intel.com>

Series applied to cxl/next
15da704b7323
bad0aa134b64

> ---
> 
> Changes in v3:
> - Log dev_name(dev) instead of dev_name(&cxlsd->cxld.dev) (Jonathan)
> - Remove double space in commit log (Jonathan)
> Changes in v2:
> - No changes in v2
> 
> 
>  drivers/cxl/core/region.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c
> index 1e211542b6b6..6d902e1c4161 100644
> --- a/drivers/cxl/core/region.c
> +++ b/drivers/cxl/core/region.c
> @@ -1938,14 +1938,13 @@ static int find_pos_and_ways(struct cxl_port *port, struct range *range,
>  			break;
>  		}
>  	}
> -	put_device(dev);
> -
>  	if (rc)
>  		dev_err(port->uport_dev,
>  			"failed to find %s:%s in target list of %s\n",
>  			dev_name(&port->dev),
> -			dev_name(port->parent_dport->dport_dev),
> -			dev_name(&cxlsd->cxld.dev));
> +			dev_name(port->parent_dport->dport_dev), dev_name(dev));
> +
> +	put_device(dev);
>  
>  	return rc;
>  }
> 
> base-commit: dc59e4fea9d83f03bad6bddf3fa2e52491777482


      parent reply	other threads:[~2026-07-24 22:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-24 22:28 [PATCH v3 1/2] cxl/region: Fix use-after-free in find_pos_and_ways() error path Alison Schofield
2026-07-24 22:28 ` [PATCH v3 2/2] cxl/region: Use __free(put_device) in find_pos_and_ways() Alison Schofield
2026-07-24 22:48 ` Dave Jiang [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=58edcca8-2a28-45fe-b5f8-87b08d22e82a@intel.com \
    --to=dave.jiang@intel.com \
    --cc=alison.schofield@intel.com \
    --cc=dave@stgolabs.net \
    --cc=iweiny@kernel.org \
    --cc=jic23@kernel.org \
    --cc=jonathan.cameron@oss.qualcomm.com \
    --cc=linux-cxl@vger.kernel.org \
    --cc=ming.li@zohomail.com \
    --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