From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796424420; b=439/4A8t/PpPFvZj2pcLVqPPmVmkiqnsOvRRl97vWeUiFH96JWjwDITj2J5v3BpkFJlK y/EVl2NZotQFt4wNLWaej+7dSVukCC4TBUC2LV5gs6Q/J3Upnwgb0KumLoRL+sLsR51vJ GgpoxY6C3UGDQzJVJgDzIzt0TXg0Jlpgv+I7dLU92jI3VYWRX1oTBbzeQt/WrWZzFtPQ9 NV5qufMiEjfnTrMQTFxu5as3/9xTjbkx1EUOgDDFA9RWCgcFfexmoLQT7sRXzgeavfbyO yIOIaZAF6Aza+dbiLu7YaOCdEvmkGY78Jf8KUgoZQjVjR2WdDAO2NRBUTdjFR3uNL1A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796424420; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=SnToiOQzOYkQkK4prfYDpNcWBSL0aIA1lcfmtQ+oSV0=; b=YhXhtZvjmsMr8yR1IlWTOD9ud0mr4TObollcGbdxkAD6LW3E1hz46BlKfBZpApuWJoZs uLj69SE4ZEFmMyYpiTO/Ii+y5KnvgXoXfjyNRXj9F9C9JS5jZWvWC9cTlBxVz60Mk2ztv 3hc02bAGmwGUUM+pgCMH9k4mD52Za0aOHHVS/w4cVrWLXJkVIFTBGM9ED9bRu/Gnj8W06 ZDBSmAKEVMMTPgLCHjob3sRnnIrCwylfxNNZW0drSvOAcTPQj5cVwWTnOvasvT6l2hlay EB3KYklxXHRP6zamOWmtek/ktBa2Qec9uXqsEbC6aj40su6aGIH92slLzv4V+JAA07A== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=l12TeCfe; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CDC39606A330 for ; Fri, 4 Dec 2026 22:47:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=l12TeCfe Received: by smtp.kernel.org (Postfix) with ESMTPSA id 85E031F00936; Fri, 4 Dec 2026 22:47:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796424420; bh=SnToiOQzOYkQkK4prfYDpNcWBSL0aIA1lcfmtQ+oSV0=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=l12TeCfeN3/M/d7NqqZdjBq24F3FiRlLBHKNPs1UoOeyH7gMO0HqPLdAe8MeyUeX7 WL4Z7JXiEv5t0cwjMLUsuaNS1CkTsyPbebPxs0HFsD1HkWQENMbJDw8zAgOpNsEBqD eqEWwdHcpXr35HUb9eB6apczMfw+h5AxZR81IhWdG/xBbQypHTd5ZtwwyRB5sVYuFL iVAO2ca5TTJdIG9e1I2QdmhhZaA8FvKsEm2WrOr2zcLnpbQumDZlJjrPh+cQbIVHVS w7uVbkldysi0irGsL8XgyiUaG/RyyjVQqy2Sr4BkNXBU3C+SDgrlCcQl/apfKMY2PB IqqpLEy4K5nKA== Date: Fri, 4 Dec 2026 16:46:58 -0600 From: Rob Herring To: Gopikrishna Garmidi 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 Message-ID: <20261204224658.GA1375606-robh@kernel.org> References: <20261201094102.1645095-1-gopikrishna.garmidi@oss.qualcomm.com> X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 > --- > 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