public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: srinivas pandruvada <srinivas.pandruvada@linux.intel.com>
To: "Harshit Mogalapalli" <harshit.m.mogalapalli@oracle.com>,
	"Hans de Goede" <hdegoede@redhat.com>,
	"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
	"Zhang Rui" <rui.zhang@intel.com>,
	platform-driver-x86@vger.kernel.org,
	linux-kernel@vger.kernel.org
Cc: dan.carpenter@linaro.org, kernel-janitors@vger.kernel.org,
	 error27@gmail.com
Subject: Re: [PATCH v2] platform/x86: ISST: fix use-after-free in tpmi_sst_dev_remove()
Date: Fri, 17 May 2024 08:15:58 -0700	[thread overview]
Message-ID: <9293c51c7d502843bfff90c5664be00bfe112e8d.camel@linux.intel.com> (raw)
In-Reply-To: <20240517144946.289615-1-harshit.m.mogalapalli@oracle.com>

On Fri, 2024-05-17 at 07:49 -0700, Harshit Mogalapalli wrote:
> In tpmi_sst_dev_remove(), tpmi_sst is dereferenced after being freed.
> Fix this by reordering the kfree() post the dereference.
> 
> Fixes: 9d1d36268f3d ("platform/x86: ISST: Support partitioned
> systems")
> Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>

> ---
> v1->v2: Add R.B from Hans and fix commit message wrapping to 75
> chars.
> This is found by smatch and only compile tested.
> ---
>  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-17 15:15 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-17 14:49 [PATCH v2] platform/x86: ISST: fix use-after-free in tpmi_sst_dev_remove() Harshit Mogalapalli
2024-05-17 15:15 ` srinivas pandruvada [this message]
2024-05-18 17:30 ` Markus Elfring
2024-05-20  9:38   ` Ilpo Järvinen
2024-05-20 10:56     ` [v2] " Markus Elfring
2024-05-20 17:49       ` Hans de Goede
2024-05-21  5:15         ` Markus Elfring
2024-05-21 10:06           ` Ilpo Järvinen
2024-05-21 10:42             ` Markus Elfring
2024-05-21 10:56               ` Ilpo Järvinen
2024-05-21 11:09                 ` Markus Elfring
2024-05-27  9:29 ` [PATCH v2] " Hans de Goede

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=9293c51c7d502843bfff90c5664be00bfe112e8d.camel@linux.intel.com \
    --to=srinivas.pandruvada@linux.intel.com \
    --cc=dan.carpenter@linaro.org \
    --cc=error27@gmail.com \
    --cc=harshit.m.mogalapalli@oracle.com \
    --cc=hdegoede@redhat.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=rui.zhang@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