From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 54142230BDB; Fri, 9 Oct 2026 14:19:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791555584; cv=none; b=vBJPv2LKHjXkrpGWJFcxsxPukTj0dFg/fg1gh5aYEZr7kHo/NhsZQQgQU+rZyK8dL1g8WB1SsH1tIMeH8NLIwpkm96dcljFDzPp0Fbv0s80gXYohU0EHEFaxnN9v/B2T3FJd6KHmEKoZZ6CsAI2i3N9IxcNKh4HiK+Frd1KWqxA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791555584; c=relaxed/simple; bh=lHdRYCQ9/z6rA1CbFuItqSOXK8J9hvysdwwcYB/VkiU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mxaQwilvBBsJ1vYQQWBCAOCR0ePmg/e39x1zNMuweIp1+UQtnP2tGYI/eF8PJeeXDnP1SEdfePksWrwAy+e2YGbV7rQQIE7DhHULRvTwz2HBGU1u43nqlkbjp1hTufPerDJqkdV3PCaCP8N723KreJ6f4qnhEBXGJPOp5LF86c0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=VnTt60Br; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="VnTt60Br" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 542EE1F00893; Fri, 9 Oct 2026 14:19:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1791555582; bh=2N/NnupTdSLNU3Au2IsCCxFA7/vSkIKq+RZQjn9LMmI=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=VnTt60BrjY6ZN9gUyeYbdOd+C91rLhj4UNOHaCr8N51Nc/k/fnU+nELU5b+/17UxX h96Nbc2h6cmHYbeeDdm6ITn9dgh0YLsGL0HEZZkZhArZlkVWUw8OGqP2RI3XqMlAwk xzl8nRDP+mb/gZOz7WXWwEi1NqOC/CG8M4hf4/g4= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Abdurrahman Hussain , "Rob Herring (Arm)" Subject: [PATCH 7.2 032/428] of/overlay: put property on deadprops only after changeset add succeeds Date: Fri, 9 Oct 2026 16:06:09 +0200 Message-ID: <20261009140946.788698292@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261009140946.008206689@linuxfoundation.org> References: <20261009140946.008206689@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 7.2-stable review patch. If anyone has any objections, please let me know. ------------------ From: Abdurrahman Hussain commit 814f2da6995772c07a7c9c2cc6028b6e3f3ecc9c upstream. add_changeset_property() links a new property of a not-yet-live target node into the node's deadprops list before handing it to of_changeset_add_property(). If that fails, the error path frees the property but leaves the freed pointer linked in deadprops, and of_node_release() frees it a second time when the aborted overlay's node is released. Record the changeset entry first and link the property into deadprops only on success. of_changeset_add_property() never looks at the node's property lists, so the order of the two steps is otherwise immaterial, and the error path frees a property that nothing references. Fixes: f96278810150 ("of: overlay: set node fields from properties when add new overlay node") Cc: stable@vger.kernel.org Assisted-by: Claude:claude-fable-5 [Claude Code] Signed-off-by: Abdurrahman Hussain Link: https://patch.msgid.link/20260831-nh-of-alias-overlay-v7-4-02754604805a@nexthop.ai Signed-off-by: Rob Herring (Arm) Signed-off-by: Greg Kroah-Hartman --- drivers/of/overlay.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) --- a/drivers/of/overlay.c +++ b/drivers/of/overlay.c @@ -358,12 +358,13 @@ static int add_changeset_property(struct return -ENOMEM; if (!prop) { - if (!target->in_livetree) { + ret = of_changeset_add_property(&ovcs->cset, target->np, + new_prop); + /* the detached node owns the property until the apply */ + if (!ret && !target->in_livetree) { new_prop->next = target->np->deadprops; target->np->deadprops = new_prop; } - ret = of_changeset_add_property(&ovcs->cset, target->np, - new_prop); } else { ret = of_changeset_update_property(&ovcs->cset, target->np, new_prop);