All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rob Herring <robh@kernel.org>
To: Gopikrishna Garmidi <gopikrishna.garmidi@oss.qualcomm.com>
Cc: saravanak@kernel.org, andersson@kernel.org,
	konrad.dybcio@oss.qualcomm.com,
	dmitry.baryshkov@oss.qualcomm.com, aisheng.dong@nxp.com,
	qperret@google.com, sibi.sankar@oss.qualcomm.com,
	devicetree@vger.kernel.org
Subject: Re: [PATCH 1/6] of: reserved_mem: Don't report a freed region as allocated
Date: Fri, 4 Dec 2026 16:46:58 -0600	[thread overview]
Message-ID: <20261204224658.GA1375606-robh@kernel.org> (raw)
In-Reply-To: <20261201094102.1645095-1-gopikrishna.garmidi@oss.qualcomm.com>

On Tue, Dec 01, 2026 at 01:41:02AM -0800, Gopikrishna Garmidi wrote:
> early_init_dt_alloc_reserved_memory_arch() stores the allocated base in
> *res_base before it marks the block nomap. If memblock_mark_nomap()
> fails, the block is returned to memblock and an error is returned, but
> *res_base still holds the freed address.
> 
> __reserved_mem_alloc_size() only treats base == 0 as failure, so for a
> dynamically allocated no-map region (and for the last range of an
> alloc-ranges list) it goes on to register memory that memblock may hand
> out to someone else.
> 
> Only set *res_base once the allocation has fully succeeded.
> 
> Fixes: 7b25995f5319 ("of: of_reserved_mem: mark nomap memory instead of removing")
> Signed-off-by: Gopikrishna Garmidi <gopikrishna.garmidi@oss.qualcomm.com>
> ---
> Found by reading the code with the help of an LLM.

Your email threading is broken and I don't have the rest of the series. 
Please fix and re-send. Please Cc Marek Szyprowski on this as well.

Rob

      reply	other threads:[~2026-12-04 22:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01  9:41 [PATCH 1/6] of: reserved_mem: Don't report a freed region as allocated Gopikrishna Garmidi
2026-12-04 22:46 ` Rob Herring [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=20261204224658.GA1375606-robh@kernel.org \
    --to=robh@kernel.org \
    --cc=aisheng.dong@nxp.com \
    --cc=andersson@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.baryshkov@oss.qualcomm.com \
    --cc=gopikrishna.garmidi@oss.qualcomm.com \
    --cc=konrad.dybcio@oss.qualcomm.com \
    --cc=qperret@google.com \
    --cc=saravanak@kernel.org \
    --cc=sibi.sankar@oss.qualcomm.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 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.