Linux CXL
 help / color / mirror / Atom feed
From: Dave Jiang <dave.jiang@intel.com>
To: Dan Williams <dan.j.williams@intel.com>, linux-cxl@vger.kernel.org
Cc: Li Ming <ming.li@zohomail.com>,
	Jonathan Cameron <Jonathan.Cameron@huawei.com>,
	Jason Gunthorpe <jgg@nvidia.com>
Subject: Re: [PATCH] cxl/fwctl: Cleanup unused fwctl_dev from cxl_features_state
Date: Fri, 7 Mar 2025 15:26:02 -0700	[thread overview]
Message-ID: <1d180475-54ae-4095-bb36-f7ec8ee17f7c@intel.com> (raw)
In-Reply-To: <174138547078.1626291.2681320775917569071.stgit@dwillia2-xfh.jf.intel.com>



On 3/7/25 3:11 PM, Dan Williams wrote:
> A review of devm_cxl_setup_fwctl() indicates a potential a use after
> free condition for the ->fwctl_dev pointer given it is not cleared after
> devm_add_action_or_reset() might have released it. However, nothing uses
> it, so just delete it.
> 
> If it ever comes back it should be returned by devm_cxl_setup_fwctl() so
> that users can always assume the pointer is either valid or NULL.
> 
> Cc: Dave Jiang <dave.jiang@intel.com>
> Cc: Li Ming <ming.li@zohomail.com>
> Cc: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Cc: Jason Gunthorpe <jgg@nvidia.com>
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>

Reviewed-by: Dave Jiang <dave.jiang@intel.com>
> ---
> 
> base-commit: da0dd17604d4c70080497091c762a790b0871eff
> 
>  drivers/cxl/core/features.c |    2 --
>  include/cxl/features.h      |    2 --
>  2 files changed, 4 deletions(-)
> 
> diff --git a/drivers/cxl/core/features.c b/drivers/cxl/core/features.c
> index caf92e9cea21..f4daefe3180e 100644
> --- a/drivers/cxl/core/features.c
> +++ b/drivers/cxl/core/features.c
> @@ -700,8 +700,6 @@ int devm_cxl_setup_fwctl(struct cxl_memdev *cxlmd)
>  	if (rc)
>  		return rc;
>  
> -	cxlfs->fwctl_dev = fwctl_dev;
> -
>  	return devm_add_action_or_reset(&cxlmd->dev, free_memdev_fwctl,
>  					no_free_ptr(fwctl_dev));
>  }
> diff --git a/include/cxl/features.h b/include/cxl/features.h
> index ead63573b0b4..fbfdc601bd85 100644
> --- a/include/cxl/features.h
> +++ b/include/cxl/features.h
> @@ -53,7 +53,6 @@ enum cxl_features_capability {
>   * @entries: CXl feature entry context
>   *	@num_features: total Features supported by the device
>   *	@ent: Flex array of Feature detail entries from the device
> - * @fwctl_dev: Firmware Control device
>   */
>  struct cxl_features_state {
>  	struct cxl_dev_state *cxlds;
> @@ -62,7 +61,6 @@ struct cxl_features_state {
>  		int num_user_features;
>  		struct cxl_feat_entry ent[] __counted_by(num_features);
>  	} *entries;
> -	struct fwctl_device *fwctl_dev;
>  };
>  
>  struct cxl_mailbox;
> 


  reply	other threads:[~2025-03-07 22:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-07 22:11 [PATCH] cxl/fwctl: Cleanup unused fwctl_dev from cxl_features_state Dan Williams
2025-03-07 22:26 ` Dave Jiang [this message]
2025-03-07 23:10   ` Jason Gunthorpe

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=1d180475-54ae-4095-bb36-f7ec8ee17f7c@intel.com \
    --to=dave.jiang@intel.com \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=dan.j.williams@intel.com \
    --cc=jgg@nvidia.com \
    --cc=linux-cxl@vger.kernel.org \
    --cc=ming.li@zohomail.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