mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
To: Su Hui <suhui@nfschina.com>,
	srinivas.pandruvada@linux.intel.com, hdegoede@redhat.com,
	ilpo.jarvinen@linux.intel.com, nathan@kernel.org,
	ndesaulniers@google.com, morbo@google.com,
	justinstitt@google.com
Cc: rui.zhang@intel.com, platform-driver-x86@vger.kernel.org,
	linux-kernel@vger.kernel.org, llvm@lists.linux.dev,
	kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] platform/x86: ISST: fix use after free problem in tpmi_sst_dev_remove()
Date: Mon, 20 May 2024 10:53:35 +0530	[thread overview]
Message-ID: <056695ad-fbb8-4ca2-a1c6-07082af6fed7@oracle.com> (raw)
In-Reply-To: <20240520021934.113877-1-suhui@nfschina.com>

Hi Su Hui,

On 20/05/24 07:49, Su Hui wrote:
> clang static checker (scan-build) warning:
> drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c:1614:24:
> Use of memory after it is freed.
> 
> Using 'tpmi_sst->package_id' after releasing 'tpmi_sst' causes this
> problem. Change the order of releasing 'tpmi_sst' to fix this.
> 

This is fixed by me already.
Ref: 
https://lore.kernel.org/all/9293c51c7d502843bfff90c5664be00bfe112e8d.camel@linux.intel.com/

Thanks,
Harshit
> Fixes: 9d1d36268f3d ("platform/x86: ISST: Support partitioned systems")
> Signed-off-by: Su Hui <suhui@nfschina.com>
> ---
>   drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c b/drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c
> index 7bac7841ff0a..7fa360073f6e 100644
> --- a/drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c
> +++ b/drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c
> @@ -1610,8 +1610,8 @@ void tpmi_sst_dev_remove(struct auxiliary_device *auxdev)
>   	tpmi_sst->partition_mask_current &= ~BIT(plat_info->partition);
>   	/* Free the package instance when the all partitions are removed */
>   	if (!tpmi_sst->partition_mask_current) {
> -		kfree(tpmi_sst);
>   		isst_common.sst_inst[tpmi_sst->package_id] = NULL;
> +		kfree(tpmi_sst);
>   	}
>   	mutex_unlock(&isst_tpmi_dev_lock);
>   }


      reply	other threads:[~2024-05-20  5:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-20  2:19 Su Hui
2024-05-20  5:23 ` Harshit Mogalapalli [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=056695ad-fbb8-4ca2-a1c6-07082af6fed7@oracle.com \
    --to=harshit.m.mogalapalli@oracle.com \
    --cc=hdegoede@redhat.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=justinstitt@google.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=morbo@google.com \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=rui.zhang@intel.com \
    --cc=srinivas.pandruvada@linux.intel.com \
    --cc=suhui@nfschina.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®