All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
To: Hyunjung Ko <hj351016@gmail.com>,
	Madhavan Srinivasan <maddy@linux.ibm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>,
	Nicholas Piggin <npiggin@gmail.com>,
	linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org, Hyunjung Ko <hj351016@gmail.com>
Subject: Re: [PATCH] powerpc/papr_scm: initialise metadata_size before reading it
Date: Fri, 20 Nov 2026 09:39:33 +0530	[thread overview]
Message-ID: <zev4jg8y.ritesh.list@gmail.com> (raw)
In-Reply-To: <20261119034745.1460361-1-hj351016@gmail.com>

Hyunjung Ko <hj351016@gmail.com> writes:

> papr_scm_probe() reads "ibm,metadata-size" into metadata_size without
> checking the return value, and the property is optional, as the comment
> right above the call says.  of_property_read_u32() only writes the output
> when it can decode a value, so for a device tree without that property
> p->metadata_size is set from an uninitialised stack value.
>
> p->metadata_size is the bound for the metadata get/set commands:
>
> 	if ((hdr->in_offset + hdr->in_length) > p->metadata_size)
>
> so a garbage value decides which metadata accesses are accepted.
> Initialise it to zero, which makes those commands reject every access
> when the platform does not advertise a metadata area.
>
> Signed-off-by: Hyunjung Ko <hj351016@gmail.com>
> Cc: stable@vger.kernel.org

Fixes: b5beae5e224f ("powerpc/pseries: Add driver for PAPR SCM regions")

With that LGTM, feel free to add:
Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>


      reply	other threads:[~2026-11-20  4:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19  3:47 [PATCH] powerpc/papr_scm: initialise metadata_size before reading it Hyunjung Ko
2026-11-20  4:09 ` Ritesh Harjani [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=zev4jg8y.ritesh.list@gmail.com \
    --to=ritesh.list@gmail.com \
    --cc=hj351016@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=maddy@linux.ibm.com \
    --cc=mpe@ellerman.id.au \
    --cc=npiggin@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.