The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: srinivas pandruvada <srinivas.pandruvada@linux.intel.com>
To: "HyeongJun An" <sammiee5311@gmail.com>,
	"Hans de Goede" <hansg@kernel.org>,
	"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Cc: platform-driver-x86@vger.kernel.org,
	linux-kernel@vger.kernel.org,  stable@vger.kernel.org
Subject: Re: [PATCH 1/2] platform/x86: ISST: Validate socket ID in clos_assoc ioctl
Date: Fri, 07 Aug 2026 11:43:03 -0700	[thread overview]
Message-ID: <188a703dcb1334750fb389cd7142e262bddae72c.camel@linux.intel.com> (raw)
In-Reply-To: <20260807144003.3498972-2-sammiee5311@gmail.com>

On Fri, 2026-08-07 at 23:40 +0900, HyeongJun An wrote:
> isst_if_clos_assoc() validates the user-supplied socket_id with
> 'socket_id > topology_max_packages()', but isst_common.sst_inst[] is
> allocated with topology_max_packages() entries, so the valid index
> range
> is [0, topology_max_packages()).  The '>' comparison lets
> socket_id == topology_max_packages() pass and index one entry past
> the
> array.
> 
> In addition, isst_common.sst_inst[socket_id] is NULL for an in-range
> package that has no bound TPMI SST instance, and the pointer is used
> without a NULL check.  Both the out-of-bounds entry and the NULL
> pointer
> are then dereferenced by map_partition_power_domain_id() and the
> following power_domain_info access.
> 
> Reject socket_id >= topology_max_packages() and a NULL sst_inst,
> matching
> the checks already performed by get_instance().
> 
> Fixes: 12a7d2cb811d ("platform/x86: ISST: Add SST-CP support via
> TPMI")
> Cc: stable@vger.kernel.org
> Assisted-by: Claude:claude-opus-5
> Signed-off-by: HyeongJun An <sammiee5311@gmail.com>

Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>

> ---
>  drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c | 4 +++-
>  1 file changed, 3 insertions(+), 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 24334ae70d82..b2965baeaa36 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
> @@ -729,7 +729,7 @@ static long isst_if_clos_assoc(void __user *argp)
>  		if (copy_from_user(&clos_assoc, ptr,
> sizeof(clos_assoc)))
>  			return -EFAULT;
>  
> -		if (clos_assoc.socket_id > topology_max_packages())
> +		if (clos_assoc.socket_id >= topology_max_packages())
>  			return -EINVAL;
>  
>  		cpu = clos_assoc.logical_cpu;
> @@ -747,6 +747,8 @@ static long isst_if_clos_assoc(void __user *argp)
>  		pkg_id = clos_assoc.socket_id;
>  
>  		sst_inst = isst_common.sst_inst[pkg_id];
> +		if (!sst_inst)
> +			return -EINVAL;
>  
>  		punit_id = map_partition_power_domain_id(sst_inst,
> punit_id, &part);
>  		if (punit_id < 0)

  reply	other threads:[~2026-08-07 18:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-07 14:40 [PATCH 0/2] platform/x86: ISST: Two ioctl input validation fixes HyeongJun An
2026-08-07 14:40 ` [PATCH 1/2] platform/x86: ISST: Validate socket ID in clos_assoc ioctl HyeongJun An
2026-08-07 18:43   ` srinivas pandruvada [this message]
2026-08-07 14:40 ` [PATCH 2/2] platform/x86: ISST: Validate level in perf mask ioctls HyeongJun An
2026-08-07 18:43   ` srinivas pandruvada
2026-08-07 18:44 ` [PATCH 0/2] platform/x86: ISST: Two ioctl input validation fixes srinivas pandruvada

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=188a703dcb1334750fb389cd7142e262bddae72c.camel@linux.intel.com \
    --to=srinivas.pandruvada@linux.intel.com \
    --cc=hansg@kernel.org \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=sammiee5311@gmail.com \
    --cc=stable@vger.kernel.org \
    /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