From nobody Sat Sep 26 13:51:50 2026 Received: from mail-pg1-f173.google.com (mail-pg1-f173.google.com [209.85.215.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 82F7E30E83A for ; Tue, 1 Sep 2026 01:29:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788226169; cv=none; b=S7dWteLyru4YSs8zAD1xzdRiYmQEEpde8N/yu8uV1IYVGkfQkmbkf73CZ4y32YwFhXPhS84yK4jEfQckBlxxhmJuvYLKgC2Dlj7tej8BADN9KJ6/ghASx/B75aTyEESnYOYtd/QIRJz4smzLgjOBpv3XdRxRwA7m/Ye9NRtFnqY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788226169; c=relaxed/simple; bh=8tup3BrXuatgt9ny9hkAUJvdMsPCnKra0uY6v5dCjDE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ImznyNfzagQG+Vfak4tiMAfRskBqnw7PuyfQCkZFwo4N6jIV77HYRWGoHScN0LmWX2aSFDPekdxwav6sDpeFj9Q1/a9Tc9DljghS5cps2yZwY2LZhPPGSfa6XDpHSPglxDb1u7XqD6mQTNnaPbzNA2+nLXrK6lRyOHNeeGFs87c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nexthop.ai; spf=pass smtp.mailfrom=nexthop.ai; dkim=pass (2048-bit key) header.d=nexthop.ai header.i=@nexthop.ai header.b=PzEQzuD4; arc=none smtp.client-ip=209.85.215.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nexthop.ai Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nexthop.ai Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nexthop.ai header.i=@nexthop.ai header.b="PzEQzuD4" Received: by mail-pg1-f173.google.com with SMTP id 41be03b00d2f7-c9e607d81fcso284229a12.2 for ; Mon, 31 Aug 2026 18:29:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nexthop.ai; s=google; t=1788226166; x=1788830966; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=umF8Nph8/KcuZfFdxXQKAx8luRRJb4eIGgsAiBw9SHk=; b=PzEQzuD4+CCA7DgF7hN2LchDqC1kbhK+hWqA4bkqqiGwJQxNJr8GVPNK8gb83TVduw g8M1bycOKult69P9eyPNTIACEJnxUW+HgwfvYvq1DI63WFA2SfZ15pNgNIlGidYYHnQm ffJvNijQquHinGVqGY/pjRSGS3WiWRfE5qLEmNcWi684/77DdYmOAT7J/sqyv390k7YS /4ssYKWs/AsRmkGrKswctVYDtbmaKij526xqq1Kb/9Sf951nvHfMmhmoSOBKK9SSvTxT ZVno0UIGoQJNH14IVJ0rXfz+vNnfWmljbOkgoKQhLGouiamDKB18+l+h63PXLcHCShVb 3Ftg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788226166; x=1788830966; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=umF8Nph8/KcuZfFdxXQKAx8luRRJb4eIGgsAiBw9SHk=; b=FaPkoBGI5XTczbkd7nxWWZXFziPIHuT7IFOi+BV6mu6PBvp16DaZLiNYoKoUFKHX6g oRz5jHlzfTNqiRoBt8GMXilicXgY1ObDmamLVcmCpaw5iu6r+cY6c8K3jTH6xJ68cW5m UVVXqBqoYiBSrrBxuyPwRfKhctcCQhajgJ0B3WQIkFHBdaDE6qkgzu8/Jv759pQKCSPB fJdP1eJjiF8IP1QPLUNyyD604gmps3dowkVoYty3HtGRe+JCX1cDISSmM1nUTPNa2UME O+aWDQeIczqBH6HC0l5yFHvV3IzSJ499ibV8K3139efag/g0eORnWcZhl5AvWNPuNBYC NpHw== X-Forwarded-Encrypted: i=1; AKwUvBwRHDhlJ8LAyaMUlVWKkvjDqJdnmr1QceF/GM4akMSgdQXP+FnY/4GrnBewRch+w2rsb3Kk7QY6cmvYlpA=@vger.kernel.org X-Gm-Message-State: AFuF++k9amdebY9SGGMIJ6ANt4bJmhy7DcyhdSmLKmcxhbf1lbV3HCdY p0RBDhkd8zRqWAcGs1viS0ydqKvke3duWVtUD2F/DvDOPbtQSY2B6vWGPq+pwapAg6w= X-Gm-Gg: AYBFou0ydTuPhVyU7pz2+TGuC1brpNWRSqL1V6TG9237FrrEUe4ljs8UJtukM2rxTl3 ourwvAwKU84yxfH89S4k8sOHwqJ95ysXXiSHajLNrIQ8HiqK9DWo0KMQcQs9wwd94dCEBLnU+j1 v4SH2c4fyu2PaE8xkeV+ZbHkbLkJ8Ani5mLxR6MtQgw0w6Es6R+awpkFHR+ulslH4Cw/w/e1YbB msxfgVrizIirYH3IhpiOZ4/AsAIYWFrzBdMXX5kgMOVOPwtGA+RDuHr69X6bGSffjx/meNTCarN 7//NFc1YReA7CZVdBna3q7ieZcdUiLGzplhK2sOpUcgBxQKgT7eW27dj9RfWC4G2mkfv1ji4iLU XA0E/vUcUM9uU4wNH4jZ6IXm/0KSo5se1bK9spOchZz57CuD4xWU3gRfPgKTPmtI3AuKkSbxYkI YJAQyHLSQxFSTyQmvgmFV1uSdN23KSqyXnfvFGnXGI+icHlDo8B+GvR13O4pKGGGc= X-Received: by 2002:a17:90b:314e:b0:398:c3ca:1ebc with SMTP id 98e67ed59e1d1-398c3ca354fmr20325515a91.18.1788226166384; Mon, 31 Aug 2026 18:29:26 -0700 (PDT) Received: from [127.0.0.2] ([50.145.100.174]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-32b5bef7683sm19390817eec.12.2026.08.31.18.29.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Aug 2026 18:29:25 -0700 (PDT) From: Abdurrahman Hussain Date: Mon, 31 Aug 2026 18:29:19 -0700 Subject: [PATCH v7 01/10] of: hold a reference on of_aliases during alias path resolution Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260831-nh-of-alias-overlay-v7-1-02754604805a@nexthop.ai> References: <20260831-nh-of-alias-overlay-v7-0-02754604805a@nexthop.ai> In-Reply-To: <20260831-nh-of-alias-overlay-v7-0-02754604805a@nexthop.ai> To: Rob Herring , Saravana Kannan , Frank Rowand , "David S. Miller" , Shawn Guo , Grant Likely , Grant Likely , Pantelis Antoniou , David Daney Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Abdurrahman Hussain X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1788226164; l=3636; i=abdurrahman@nexthop.ai; s=20260510; h=from:subject:message-id; bh=8tup3BrXuatgt9ny9hkAUJvdMsPCnKra0uY6v5dCjDE=; b=ZbRUgfacsqPh/5HiLuma3U63NxSpJqiiWmlWqJOaladB4CCnLh7l7xgcG82y2oZF/Dp7YdTUB P4FAhUF2SkpBVYzsiBR4VDoMsVZ1jbPGGY79D8ABflo8J+OQNzQKhiD X-Developer-Key: i=abdurrahman@nexthop.ai; a=ed25519; pk=omTm9cCAbO0ZhS32aKfJDKue0W3sQGpG9ub5eYHif8I= of_find_node_opts_by_path() walks the property list of of_aliases without taking a reference on the node and passes pp->value straight to of_find_node_by_path(). Take a reference across the walk. The walk itself stays lock-free like every other property iteration: it can race property surgery and see a stale view (a removed property's ->next is repointed at the deadprops list), but nothing it can reach is freed while the node reference is held. The pointer load itself needs no locking: of_aliases always holds a reference on the node it points to, so a reader that observes a non-NULL pointer observes a live node. A later patch in this series clears of_aliases and drops that reference when the node is detached at runtime; the detach path holds its own references across the transition. Validate the value before resolving it. of_alias_value_ok() requires a non-empty, NUL-terminated, absolute path: - an empty property has a NULL value and crashes in strchr() - a value without a NUL inside the property is read past its end - a relative value naming another alias (loop =3D "loop") recurses through of_find_node_by_path() until the stack is exhausted All three are reachable with a malformed boot FDT today. The name comparison loses its redundant strlen() pass while here. Fixes: c22e650e66b8 ("of: Make of_find_node_by_path() handle /aliases") Assisted-by: Claude:claude-fable-5 [Claude Code] Signed-off-by: Abdurrahman Hussain --- drivers/of/base.c | 17 ++++++++++++----- drivers/of/of_private.h | 8 ++++++++ 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/drivers/of/base.c b/drivers/of/base.c index 378703dbc11f..f7aa14d90e50 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -995,6 +995,8 @@ struct device_node *of_find_node_opts_by_path(const cha= r *path, const char **opt =20 /* The path could begin with an alias */ if (*path !=3D '/') { + struct device_node *aliases; + const char *value =3D NULL; int len; const char *p =3D strchrnul(path, '/'); =20 @@ -1002,16 +1004,21 @@ struct device_node *of_find_node_opts_by_path(const= char *path, const char **opt p =3D separator; len =3D p - path; =20 - /* of_aliases must not be NULL */ - if (!of_aliases) + aliases =3D of_node_get(of_aliases); + if (!aliases) return NULL; =20 - for_each_property_of_node(of_aliases, pp) { - if (strlen(pp->name) =3D=3D len && !strncmp(pp->name, path, len)) { - np =3D of_find_node_by_path(pp->value); + for_each_property_of_node(aliases, pp) { + if (!strncmp(pp->name, path, len) && !pp->name[len]) { + if (of_alias_value_ok(pp)) + value =3D pp->value; break; } } + /* the reference on @aliases keeps @value alive */ + if (value) + np =3D of_find_node_by_path(value); + of_node_put(aliases); if (!np) return NULL; path =3D p; diff --git a/drivers/of/of_private.h b/drivers/of/of_private.h index 0ae16da066e2..9bba999f0bf8 100644 --- a/drivers/of/of_private.h +++ b/drivers/of/of_private.h @@ -215,6 +215,14 @@ static inline bool is_pseudo_property(const char *prop= _name) !of_prop_cmp(prop_name, "linux,phandle"); } =20 +/* alias values must be absolute paths NUL-terminated within length */ +static inline bool of_alias_value_ok(const struct property *pp) +{ + return pp->value && pp->length >=3D 2 && + *(const char *)pp->value =3D=3D '/' && + strnlen(pp->value, pp->length) < pp->length; +} + #if IS_ENABLED(CONFIG_KUNIT) int __of_address_resource_bounds(struct resource *r, u64 start, u64 size); #endif --=20 2.54.0 From nobody Sat Sep 26 13:51:50 2026 Received: from mail-pg1-f173.google.com (mail-pg1-f173.google.com [209.85.215.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A69B32F3C18 for ; Tue, 1 Sep 2026 01:29:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788226171; cv=none; b=myI3l6c594+GvIeIeOLKIg2Avm2EXcQuIiXw5N/ynAjmEf7TmWqKjSytrxX013g201AKbCgmqPfoIO+M5GJH/sAI5tCBy1aAfgv3IhBUKWBf8kfnEMOj6LWMPWx73KKAwlPfFs4NPPiFd13E5Xqn14PzGlGszBxBfohvY6jEnKA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788226171; c=relaxed/simple; bh=HHPbnFg/6LLSJDTZN4vrpNfAb2y21Om1UreVNkgyK0A=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=UeGcA/KsvrtOC8ecwK13KWpF2SfaZEquHEHkNg//2G2m+1FRoDiaFetKN87uSrf2Bngx5UkL8xLhE+Le2yKQHYD7Gx8F9e2k79myXVVOwo8ECRP+OQ1DzQBFIPh4+rjtZsh/oK6M0SO97X+BzRQo2VTEP2KaHEjRronJZx8Xm64= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nexthop.ai; spf=pass smtp.mailfrom=nexthop.ai; dkim=pass (2048-bit key) header.d=nexthop.ai header.i=@nexthop.ai header.b=T/9ByHfo; arc=none smtp.client-ip=209.85.215.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nexthop.ai Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nexthop.ai Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nexthop.ai header.i=@nexthop.ai header.b="T/9ByHfo" Received: by mail-pg1-f173.google.com with SMTP id 41be03b00d2f7-cbe6295f05bso388147a12.1 for ; Mon, 31 Aug 2026 18:29:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nexthop.ai; s=google; t=1788226167; x=1788830967; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=0NVKKl81fU/CQuRIFdsvNj0ubnql/KKTqeCqVjLnots=; b=T/9ByHfo1euqtz/8zbhqYVERx+jegEL/9230KfXDARbr7GZ8fJx1JTMSZ26VKeMPXD ei2ycz6GizhpMtrpTcvi5wSvT7xS6Gj4hnNr1tYryiJxDIKZAKMLzacjxQLL59WjaJ84 /mXUC7q0kdnRulAO/r0t5uk3QmeLYxEuV6mbW7ZcG3wfXCrfn6eDvYSHp+ye9hwRoxGV bzOZcvDyl99O3fVs2Z8jXM9+huHpZzBUQpLNx2xNkHinwWsU7KIMA/Cxpsn4Aqg8CFjU QEmOiLqMAGhQu4zqH24N44B8xn/96AcognEe6E55QD3PVYv6gj7QY8ie8uVykBeyNnjH 6E9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788226167; x=1788830967; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=0NVKKl81fU/CQuRIFdsvNj0ubnql/KKTqeCqVjLnots=; b=bqTyKXlgsYJM4e+82sOrKdyoiz3SNS5eF5Puj0uLQrzBceAXsA73uFsPG1gdPtI6fQ DtUa/FTQMthBNNrqJhk6IBYXwHKaPAdm1xziJNXYR8oZZoWNnkKaAR+daiCtc5uyjNPG OJSwVrnU66zFh8l7t24wul6SyK6HhS5m9RpeE6iM+qbgzD40ILsudlFscK5e/HBxgwra c1pyuYkr/DdIOOKXHX0ViF321EawDARtmwa295X4f0VooD8kJKX3bzblvrbO1P389MYK 2d7x38w1ARY1prva+r0rzHtdqLxWeIeh33P2Rd7x+43SIE65woHWxVvrbHrLIVrsJppE zY1g== X-Forwarded-Encrypted: i=1; AKwUvByvczykvKPMwi2Ts7DNlpmIAGz63iH2OPPUi1sHVI1FoLw/4sG4r/AEjY21jFDmW/tKVFkxH/XoNIniKYs=@vger.kernel.org X-Gm-Message-State: AFuF++k0rxy7T3u2C7TSxrSyVpUwkZ+sGtni4L0LH6kf3o8vp8gBz1nu txGwDgZk/gjm4VmhIexIzjc+DwyWZaNuSRlD2TJvcoWftxW7wIqN/CZ1tYRz2eynSMw= X-Gm-Gg: AYBFou2tIK7nYmBogsztxU8DT6dKDPYtq7DbKzsv8f/v7epKmvHyVZ6TlCQMsQABUGJ jZGBhZFTfJxIwDyK5q/2+ZGRec1N7pAwuW6Xxy5TYz4hPXWYHPpQW6+goEB+PBNLxxbvCjrJclp TtQwXDTV53O3socZJTsk8gi+GqYMJurYjqGBIthuqr4O4OfB/bXWdWxPnvWs8W6PgDwk7fN0dix llvhwr5oxwNcnODw9h50ihP8kPC1XXTqq1pUmGY2DjhvvZbKcFQN0SOHvl5ht+WYy9+x/EBfObq iydQZ/gJUtpgpfB4+tgO0QKYglxts+prPCN77JD09Rb7mKfEe9CEnXWAKyV0leicbes4dR3b5hd brHu66qnlwX7kmyYT8vx4PByUMDxxuvAIAyoE4i5IC74XeP+jwUqaFW4fLbrpN3HBy17SwHYGgl MVhyevc312hVjZAP76ZEK7SRtzy3szo8HxH+5kjwsywupPDoxJmTS51yz0ikkpK1A= X-Received: by 2002:a17:90a:c110:b0:396:7c01:553f with SMTP id 98e67ed59e1d1-3990f8a8dc3mr2030397a91.21.1788226167356; Mon, 31 Aug 2026 18:29:27 -0700 (PDT) Received: from [127.0.0.2] ([50.145.100.174]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-32b5bef7683sm19390817eec.12.2026.08.31.18.29.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Aug 2026 18:29:26 -0700 (PDT) From: Abdurrahman Hussain Date: Mon, 31 Aug 2026 18:29:20 -0700 Subject: [PATCH v7 02/10] of: update /aliases lookup on reconfig notifications Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260831-nh-of-alias-overlay-v7-2-02754604805a@nexthop.ai> References: <20260831-nh-of-alias-overlay-v7-0-02754604805a@nexthop.ai> In-Reply-To: <20260831-nh-of-alias-overlay-v7-0-02754604805a@nexthop.ai> To: Rob Herring , Saravana Kannan , Frank Rowand , "David S. Miller" , Shawn Guo , Grant Likely , Grant Likely , Pantelis Antoniou , David Daney Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Abdurrahman Hussain X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1788226164; l=11267; i=abdurrahman@nexthop.ai; s=20260510; h=from:subject:message-id; bh=HHPbnFg/6LLSJDTZN4vrpNfAb2y21Om1UreVNkgyK0A=; b=EBuWe1hDbi1tsoCCSvqwENOllyrKYHQUWmSIpIk3eCgiy97GoyUg9lfrp2XlNmPkfS6elWMrl j8d/JRvdAVIAtTNk88GnfBcbpJ3QnaYFW0OEX9GHIIcqsV2ei87Zrjf X-Developer-Key: i=abdurrahman@nexthop.ai; a=ed25519; pk=omTm9cCAbO0ZhS32aKfJDKue0W3sQGpG9ub5eYHif8I= Aliases added by overlays never make it into aliases_lookup, which is only filled by of_alias_scan() at boot. of_alias_get_id() returns -ENODEV for them and drivers using alias based numbering (i2c, spi, tty, mmc) fall back to dynamic ids. Register a reconfig notifier and mirror /aliases property changes into aliases_lookup. The notifier chain covers changesets and overlays, so no overlay specific hook is needed. Same approach as Geert's 2015 series [1], which was never reposted; of_alias_create()/of_alias_destroy() keep its names. The /aliases node is matched by name and root parent instead of the of_aliases pointer, which is still NULL when an overlay creates the node on a system without a boot-time /aliases. The name match is exact, of_node_name_eq() would also match "aliases@1". ATTACH stores the node in of_aliases with a reference held, DETACH drops it again and flushes aliases_lookup. The reference makes the lock-free of_node_get(of_aliases) in of_find_node_opts_by_path() safe: a reader that observes a non-NULL pointer observes a live node, and on DETACH the changeset holds its own references across the notifier so the put here cannot be the final one while readers still walk the node. Nodes attached with properties already set are not scanned, as before. Lookup entries are created by of_alias_scan()'s old loop body, moved into of_alias_create(). Entries created at runtime have kstrdup'ed names and an of_node_get'ed target and are flagged "owned" so of_alias_destroy() knows what to kfree(); boot entries live in memblock and are only unlinked. Removal matches entries regardless of ownership so updating a boot-time alias does not leave duplicates behind, which was Grant's main concern on the old series [2]. A new aliases_mutex protects the list. of_mutex does not work here: the notifier runs under it on the overlay path but outside of it on the of_add_property() path. of_alias_create() skips names that are empty or all digits instead of creating an entry with an empty stem. Only built for CONFIG_OF_DYNAMIC: there are no notifications without it and the register stub returns -EINVAL. Link: https://lore.kernel.org/lkml/1435675876-2159-1-git-send-email-geert+r= enesas@glider.be/ [1] Link: https://lore.kernel.org/lkml/20150630172131.D4E6CC4041A@trevor.secret= lab.ca/ [2] Assisted-by: Claude:claude-fable-5 [Claude Code] Signed-off-by: Abdurrahman Hussain --- drivers/of/base.c | 199 ++++++++++++++++++++++++++++++++++++++------= ---- drivers/of/device.c | 4 +- drivers/of/of_private.h | 14 ++++ 3 files changed, 175 insertions(+), 42 deletions(-) diff --git a/drivers/of/base.c b/drivers/of/base.c index f7aa14d90e50..23d9bb073d8b 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -1926,6 +1926,159 @@ static void of_alias_add(struct alias_prop *ap, str= uct device_node *np, ap->alias, ap->stem, ap->id, np); } =20 +/* + * Protects aliases_lookup and of_aliases. of_alias_scan() runs single- + * threaded at init and skips it; every other reader/writer must hold it. + */ +DEFINE_MUTEX(aliases_mutex); + +/* Callers other than of_alias_scan() must hold @aliases_mutex. */ +static void of_alias_create(const struct property *pp, + void *(*dt_alloc)(u64 size, u64 align), + bool owned) +{ + const char *start =3D pp->name; + const char *end; + struct device_node *np; + struct alias_prop *ap; + const char *dup; + int id, len; + + if (is_pseudo_property(pp->name)) + return; + + if (!of_alias_value_ok(pp)) + return; + + np =3D of_find_node_by_path(pp->value); + if (!np) + return; + + end =3D start + strlen(start); + while (end > start && isdigit(*(end - 1))) + end--; + len =3D end - start; + if (len =3D=3D 0) + goto out_put; + + if (kstrtoint(end, 10, &id) < 0) + goto out_put; + + ap =3D dt_alloc(sizeof(*ap) + len + 1, __alignof__(*ap)); + if (!ap) + goto out_put; + memset(ap, 0, sizeof(*ap) + len + 1); + + if (owned) { + dup =3D kstrdup(pp->name, GFP_KERNEL); + if (!dup) { + kfree(ap); + goto out_put; + } + } else { + dup =3D start; + } + ap->alias =3D dup; + ap->owned =3D owned; + of_alias_add(ap, np, id, start, len); + return; + +out_put: + of_node_put(np); +} + +#ifdef CONFIG_OF_DYNAMIC +/* Unlink @ap; free its storage if it was runtime-allocated. */ +static void __of_alias_del(struct alias_prop *ap) +{ + list_del(&ap->link); + of_node_put(ap->np); + if (ap->owned) { + kfree(ap->alias); + kfree(ap); + } +} + +/* Callers must hold @aliases_mutex. */ +static void of_alias_destroy(const char *name) +{ + struct alias_prop *ap, *tmp; + + list_for_each_entry_safe(ap, tmp, &aliases_lookup, link) { + if (strcmp(ap->alias, name) !=3D 0) + continue; + __of_alias_del(ap); + return; + } +} + +static void *alias_alloc(u64 size, u64 align) +{ + return kzalloc(size, GFP_KERNEL); +} + +/* Callers must hold @aliases_mutex. */ +static void of_aliases_forget_all(void) +{ + struct alias_prop *ap, *tmp; + + list_for_each_entry_safe(ap, tmp, &aliases_lookup, link) + __of_alias_del(ap); +} + +static int of_aliases_reconfig_notifier(struct notifier_block *nb, + unsigned long action, void *arg) +{ + struct of_reconfig_data *rd =3D arg; + + /* of_aliases may still be NULL when an overlay creates the node */ + if (!rd->dn || !of_node_is_aliases(rd->dn)) + return NOTIFY_DONE; + + mutex_lock(&aliases_mutex); + switch (action) { + case OF_RECONFIG_ATTACH_NODE: + if (!of_aliases) + of_aliases =3D of_node_get(rd->dn); + break; + case OF_RECONFIG_DETACH_NODE: + if (of_aliases =3D=3D rd->dn) { + of_aliases =3D NULL; + of_aliases_forget_all(); + of_node_put(rd->dn); + } + break; + case OF_RECONFIG_ADD_PROPERTY: + of_alias_create(rd->prop, alias_alloc, true); + break; + case OF_RECONFIG_REMOVE_PROPERTY: + of_alias_destroy(rd->prop->name); + break; + case OF_RECONFIG_UPDATE_PROPERTY: + if (rd->old_prop) + of_alias_destroy(rd->old_prop->name); + of_alias_create(rd->prop, alias_alloc, true); + break; + default: + break; + } + mutex_unlock(&aliases_mutex); + return NOTIFY_OK; +} + +static struct notifier_block of_aliases_nb =3D { + .notifier_call =3D of_aliases_reconfig_notifier, +}; + +static int __init of_aliases_reconfig_init(void) +{ + return of_reconfig_notifier_register(&of_aliases_nb); +} + +/* of_alias_scan() runs pre-initcall, so the boot-time scan is complete */ +core_initcall_sync(of_aliases_reconfig_init); +#endif /* CONFIG_OF_DYNAMIC */ + /** * of_alias_scan - Scan all properties of the 'aliases' node * @dt_alloc: An allocator that provides a virtual address to memory @@ -1961,42 +2114,8 @@ void of_alias_scan(void * (*dt_alloc)(u64 size, u64 = align)) if (!of_aliases) return; =20 - for_each_property_of_node(of_aliases, pp) { - const char *start =3D pp->name; - const char *end =3D start + strlen(start); - struct device_node *np; - struct alias_prop *ap; - int id, len; - - /* Skip those we do not want to proceed */ - if (is_pseudo_property(pp->name)) - continue; - - np =3D of_find_node_by_path(pp->value); - if (!np) - continue; - - /* walk the alias backwards to extract the id and work out - * the 'stem' string */ - while (end > start && isdigit(*(end - 1))) - end--; - len =3D end - start; - - if (kstrtoint(end, 10, &id) < 0) { - of_node_put(np); - continue; - } - - /* Allocate an alias_prop with enough space for the stem */ - ap =3D dt_alloc(sizeof(*ap) + len + 1, __alignof__(*ap)); - if (!ap) { - of_node_put(np); - continue; - } - memset(ap, 0, sizeof(*ap) + len + 1); - ap->alias =3D start; - of_alias_add(ap, np, id, start, len); - } + for_each_property_of_node(of_aliases, pp) + of_alias_create(pp, dt_alloc, false); } =20 /** @@ -2014,7 +2133,7 @@ int of_alias_get_id(const struct device_node *np, con= st char *stem) struct alias_prop *app; int id =3D -ENODEV; =20 - mutex_lock(&of_mutex); + mutex_lock(&aliases_mutex); list_for_each_entry(app, &aliases_lookup, link) { if (strcmp(app->stem, stem) !=3D 0) continue; @@ -2024,7 +2143,7 @@ int of_alias_get_id(const struct device_node *np, con= st char *stem) break; } } - mutex_unlock(&of_mutex); + mutex_unlock(&aliases_mutex); =20 return id; } @@ -2042,7 +2161,7 @@ int of_alias_get_highest_id(const char *stem) struct alias_prop *app; int id =3D -ENODEV; =20 - mutex_lock(&of_mutex); + mutex_lock(&aliases_mutex); list_for_each_entry(app, &aliases_lookup, link) { if (strcmp(app->stem, stem) !=3D 0) continue; @@ -2050,7 +2169,7 @@ int of_alias_get_highest_id(const char *stem) if (app->id > id) id =3D app->id; } - mutex_unlock(&of_mutex); + mutex_unlock(&aliases_mutex); =20 return id; } diff --git a/drivers/of/device.c b/drivers/of/device.c index be4e1584e0af..5ca249fca02f 100644 --- a/drivers/of/device.c +++ b/drivers/of/device.c @@ -238,7 +238,7 @@ void of_device_uevent(const struct device *dev, struct = kobj_uevent_env *env) add_uevent_var(env, "OF_COMPATIBLE_N=3D%d", seen); =20 seen =3D 0; - mutex_lock(&of_mutex); + mutex_lock(&aliases_mutex); list_for_each_entry(app, &aliases_lookup, link) { if (dev->of_node =3D=3D app->np) { add_uevent_var(env, "OF_ALIAS_%d=3D%s", seen, @@ -246,7 +246,7 @@ void of_device_uevent(const struct device *dev, struct = kobj_uevent_env *env) seen++; } } - mutex_unlock(&of_mutex); + mutex_unlock(&aliases_mutex); } EXPORT_SYMBOL_GPL(of_device_uevent); =20 diff --git a/drivers/of/of_private.h b/drivers/of/of_private.h index 9bba999f0bf8..731b606ae3e3 100644 --- a/drivers/of/of_private.h +++ b/drivers/of/of_private.h @@ -17,6 +17,11 @@ * @alias: Alias property name * @np: Pointer to device_node that the alias stands for * @id: Index value from end of alias name + * @owned: True for runtime entries, where the struct and @alias are + * kmalloc'd/kstrdup'd and freed on removal. False for boot-time + * entries, which live in memblock (@alias points into the FDT) + * and are only unlinked. Every entry holds a reference on @np; + * removal drops it regardless of @owned. * @stem: Alias string without the index * * The structure represents one alias property of 'aliases' node as @@ -27,6 +32,7 @@ struct alias_prop { const char *alias; struct device_node *np; int id; + bool owned; char stem[]; }; =20 @@ -40,6 +46,7 @@ struct alias_prop { =20 extern struct mutex of_mutex; extern raw_spinlock_t devtree_lock; +extern struct mutex aliases_mutex; extern struct list_head aliases_lookup; extern struct kset *of_kset; =20 @@ -223,6 +230,13 @@ static inline bool of_alias_value_ok(const struct prop= erty *pp) strnlen(pp->value, pp->length) < pp->length; } =20 +/* the /aliases node: root child with the exact name "aliases" */ +static inline bool of_node_is_aliases(const struct device_node *np) +{ + return of_node_is_root(np->parent) && + !strcmp(kbasename(np->full_name), "aliases"); +} + #if IS_ENABLED(CONFIG_KUNIT) int __of_address_resource_bounds(struct resource *r, u64 start, u64 size); #endif --=20 2.54.0 From nobody Sat Sep 26 13:51:50 2026 Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 834DE18DB2A for ; Tue, 1 Sep 2026 01:29:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788226171; cv=none; b=t5PasmYkI1SZti8LrQPEUAnxSMh0Kj5CwMEaijUNQfw+AKRSNPPSk7I4OHjLaXKqdfwLodHdxKpvtt4AvAVO3FlvQeW5Rz+OnD16F89Z9DpCAB2oiCbVPwKpttAss4VNsiOLLuel2QXJpMf61u9XBjol+xUJu8jqASuD5oX6FWc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788226171; c=relaxed/simple; bh=i+iwVi9KMRy/SRzPz0dFMHY5QfWjU3ehExfRWdvyWCg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=awBzQNQC1SkvCGjPM/Y99eKJsrjbKL4atBZpcas8O0kqfIfywutTCOFqttLjVk/daKvLxQTEBlAxroWy29A9yF4KzCATvquuCzZtAV119RwaApOqzIeHDXeygHcYGub3AMBU+lkBvqYIbZloum99lS+P74Zh1Z6xAYWIf6knFrQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nexthop.ai; spf=pass smtp.mailfrom=nexthop.ai; dkim=pass (2048-bit key) header.d=nexthop.ai header.i=@nexthop.ai header.b=DeSEGmrj; arc=none smtp.client-ip=209.85.214.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nexthop.ai Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nexthop.ai Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nexthop.ai header.i=@nexthop.ai header.b="DeSEGmrj" Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-2d5cad1a6baso39738485ad.3 for ; Mon, 31 Aug 2026 18:29:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nexthop.ai; s=google; t=1788226169; x=1788830969; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=CUT2qIYHjpXWpwH1J8XuYKZa+9kxUUZTpxZC6ZkH8Ds=; b=DeSEGmrjmeIpGGwqrXABSvCWGqPSZrHn2OMSgiCHFoRBmkAkB+1D4N/h4OdfkHmvl6 IU87FTkiz8x0IDp7Cp6M3RIS24XTT1FSO7x/TSShR0BcSei4kgoeAXytJx7V/GRmBnzj so4MvINNskAYOfMxWM2wX14crBOhwfG1GlUAapMVR/9Iyo2AC4eA3ZAjIWsIEtBw8YgO YmEwbX6zJT3xUTVIiF+6kXZOihJa1SYLH06wWdSM1HlusVH1HvxhEoTzs6AiDwgpSbKn 1pN/UQHlE25xa8v4U0NkOv/h30XHtfT20G1PLL2uHsApyzJ883oMm2wdBEW8FcECvFG9 WlJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788226169; x=1788830969; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=CUT2qIYHjpXWpwH1J8XuYKZa+9kxUUZTpxZC6ZkH8Ds=; b=RDC7rEzvnM0Dly5VqpLASVmeqn7BLK75l9sIMZID/T9fpjInA/yu81FgmpWIXS2VPc s8J5RdPHxG5GjSKTONDhyIpbwB4fVI5iSZGRK24GpIiIW+YgX50KASwazM/0kHrm74Ow MhXzuu7bVbn+q1SUNdE+OGENqASZ0MAn2X9AAWFApXdWFQkoFIDfZ2gTSjjROSmhD+A8 Inam8P+eV6v12JiLbAC8z8dPKFnISc6FzFOOfbQ/36+xj7wb7S2VSnI49vmvF2oZuhYR ixjOq3O8rBmsuzvNbot3/HSHzM9jBsMXwcksE9FfGHFt/fWvzGo6fQKRKzq5sj0ImoVN fRXw== X-Forwarded-Encrypted: i=1; AKwUvBwpFiM9FAMxjaNfQob+8xA4Y/pdf3HVk4m9s9ZXOtcwd2utmTG2h7mY5EGTj/JjzO1QLy5s4B4JSlGwaXo=@vger.kernel.org X-Gm-Message-State: AFuF++nIOGuIM3QNWyCnKX9sLncXSE7AsUYyMkGarKWS3xQDt8g1ESnA PG22oZQogOnTZiw/Tvo3S+NihlZCu56CdN3luQtzYGx8EjoevR1Hfe43KKKVT4HSWxk= X-Gm-Gg: AYBFou29gaJEn9TEtRnck6NAa1SAXRBUBhTReL+uZfPoIjWhHDmqf/92FocH4o30Sj4 dPl3Dvv4jMODORIcKSpIOLbFUCEnq72l5xoerQDfG/k2AMFhqr0jSIrKhu0bbecvlLsKBH1vYU0 I21vSRRoPrI1c0/5D+Xu3+AP7Cm+1WcxWdnFzYNwg1Oz7d051YqO3Pm8WnKkU0K389KiiTzUMgS M3IArZSFI03/9TaB2JTNFt7H8/6RZwc/HMbQFK3iDJlvMYBw7izY2lushuHSP8ZwDhme8/2efuh v0aA4386Hfzdb4XJxdmFnDWRkNeMWeWHtNXqu+sYL6o9OoAIJW40hTXAaRcUNqQMtyQ2dGBdjEX WL/Kk1QVY5vQbOEE0fZCemCtgcCfTjOhMOl9OuErRqDnIdiAUtGUwn0GNZeeoi2CWzpmD3ejE0y bQ7x8W2ILNwUFJffO+4ooNevaO5aCc2X2ny0T6jgo3C18QNhHYhdkeS6qmdFROuNk= X-Received: by 2002:a17:90b:39a3:b0:38e:bbf1:de3f with SMTP id 98e67ed59e1d1-39907d659e6mr5963354a91.12.1788226168597; Mon, 31 Aug 2026 18:29:28 -0700 (PDT) Received: from [127.0.0.2] ([50.145.100.174]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-32b5bef7683sm19390817eec.12.2026.08.31.18.29.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Aug 2026 18:29:27 -0700 (PDT) From: Abdurrahman Hussain Date: Mon, 31 Aug 2026 18:29:21 -0700 Subject: [PATCH v7 03/10] of/overlay: look up absolute target-paths absolutely Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260831-nh-of-alias-overlay-v7-3-02754604805a@nexthop.ai> References: <20260831-nh-of-alias-overlay-v7-0-02754604805a@nexthop.ai> In-Reply-To: <20260831-nh-of-alias-overlay-v7-0-02754604805a@nexthop.ai> To: Rob Herring , Saravana Kannan , Frank Rowand , "David S. Miller" , Shawn Guo , Grant Likely , Grant Likely , Pantelis Antoniou , David Daney Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Abdurrahman Hussain X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1788226164; l=3883; i=abdurrahman@nexthop.ai; s=20260510; h=from:subject:message-id; bh=i+iwVi9KMRy/SRzPz0dFMHY5QfWjU3ehExfRWdvyWCg=; b=fGoY5kqjFOHUBx3oflOqjwJk2wJqqeVBud53A45eDFKq+qsDbtsEs8qzUe+ydOswCaZGFRM0o jPuzn1QvxLiDfm12tMXBFTi1mIQVqVTsUkuxxvpkBKCyV1s8+CtHlyv X-Developer-Key: i=abdurrahman@nexthop.ai; a=ed25519; pk=omTm9cCAbO0ZhS32aKfJDKue0W3sQGpG9ub5eYHif8I= find_target() with a non-NULL target base concatenates the base path and the fragment's target-path via "%pOF%s": target-path=3D"/foo" resolves to "/foo" and can never reach the DT root. An overlay applied with a base cannot both extend the base subtree and add /aliases entries, which is what a PCI device declaring its peripherals under dev_of_node() needs for alias-based bus numbering. Treat any non-empty target-path as absolute. An empty target-path still means the base itself, the only form used by the one in-tree caller passing a base (drivers/misc/lan966x_pci.c). Spell the contract out in the kernel-doc for @base/@target_base and in find_target()'s strategy comment. Assisted-by: Claude:claude-fable-5 [Claude Code] Signed-off-by: Abdurrahman Hussain --- drivers/of/overlay.c | 38 ++++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/drivers/of/overlay.c b/drivers/of/overlay.c index 08d5351746be..74aea704835a 100644 --- a/drivers/of/overlay.c +++ b/drivers/of/overlay.c @@ -688,12 +688,15 @@ static int build_changeset(struct overlay_changeset *= ovcs) * * 1) "target" property containing the phandle of the target * 2) "target-path" property containing the path of the target + * + * With a non-NULL @target_base, an empty "target-path" means + * @target_base itself; any non-empty "target-path" is resolved + * absolutely from the live-tree root. */ static struct device_node *find_target(const struct device_node *info_node, const struct device_node *target_base) { struct device_node *node; - char *target_path; const char *path; u32 val; int ret; @@ -709,23 +712,14 @@ static struct device_node *find_target(const struct d= evice_node *info_node, =20 ret =3D of_property_read_string(info_node, "target-path", &path); if (!ret) { - if (target_base) { - target_path =3D kasprintf(GFP_KERNEL, "%pOF%s", target_base, path); - if (!target_path) - return NULL; - node =3D of_find_node_by_path(target_path); - if (!node) { - pr_err("find target, node: %pOF, path '%s' not found\n", - info_node, target_path); - } - kfree(target_path); - } else { - node =3D of_find_node_by_path(path); - if (!node) { - pr_err("find target, node: %pOF, path '%s' not found\n", - info_node, path); - } - } + /* an empty target-path means the target base itself */ + if (target_base && path[0] =3D=3D '\0') + return of_node_get((struct device_node *)target_base); + + node =3D of_find_node_by_path(path); + if (!node) + pr_err("find target, node: %pOF, path '%s' not found\n", + info_node, path); return node; } =20 @@ -737,7 +731,9 @@ static struct device_node *find_target(const struct dev= ice_node *info_node, /** * init_overlay_changeset() - initialize overlay changeset from overlay tr= ee * @ovcs: Overlay changeset to build - * @target_base: Point to the target node to apply overlay + * @target_base: Target for fragments with an empty "target-path"; + * fragments with a non-empty "target-path" resolve + * absolutely and ignore @target_base * * Initialize @ovcs. Populate @ovcs->fragments with node information from * the top level of @overlay_root. The relevant top level nodes are the @@ -982,7 +978,9 @@ static int of_overlay_apply(struct overlay_changeset *o= vcs, * @overlay_fdt: pointer to overlay FDT * @overlay_fdt_size: number of bytes in @overlay_fdt * @ret_ovcs_id: pointer for returning created changeset id - * @base: pointer for the target node to apply overlay + * @base: target for fragments with an empty "target-path"; + * fragments with a non-empty "target-path" resolve + * absolutely and ignore @base * * Creates and applies an overlay changeset. * --=20 2.54.0 From nobody Sat Sep 26 13:51:50 2026 Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B3A4D3542F6 for ; Tue, 1 Sep 2026 01:29:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788226173; cv=none; b=I+uGHUUKTBw6GArxmGSXUFY/VYiQ3hQdEEkoNPCaW+XL7E6M93TuUMW/agvvn5PECuZbNTF+xmo8jQiVPqz8JBH7zTiMZRdoOUCeV1muoYBU0JaGg5OgsLQnhcTZo2bmitld58G7auRwSzK7ioGZMuGIMVD0jMWFAduVsvEyy/o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788226173; c=relaxed/simple; bh=npzZe06PtobvJpaMjSbQwwuI2JcJx4uej0mJwKkmuwE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=hKPfPAQOpQ1UiQOOk1LIElGYULbQ1bGPORGAkYU0x1o/dudLeBFrvOwQFVSu/NeC7PJS+5YYx1cc6jtbLzw+q1CMHOW8doV8bM3UGnIAlHdhVNx/sw5s4yIDjp1866j7G3D0xRUSnw6il7+tfy3Ar4uVef1orKEZjosXwdAWo0s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nexthop.ai; spf=pass smtp.mailfrom=nexthop.ai; dkim=pass (2048-bit key) header.d=nexthop.ai header.i=@nexthop.ai header.b=MFiGOiBK; arc=none smtp.client-ip=209.85.214.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nexthop.ai Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nexthop.ai Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nexthop.ai header.i=@nexthop.ai header.b="MFiGOiBK" Received: by mail-pl1-f179.google.com with SMTP id d9443c01a7336-2d72ae08fa1so35178475ad.2 for ; Mon, 31 Aug 2026 18:29:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nexthop.ai; s=google; t=1788226170; x=1788830970; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=ijPMp0aoruOjxz0EUwVJJByK31zD+FexQPaTyeeUmWw=; b=MFiGOiBKMr0NL6Vm/6oJ7ZF6sbI1qGwhY728k6V4AyiyCbdriB/gR8mLEF6otwkf7s q72iR1XxoqvqKHA19IAswtmfWXJZBdPC2ZdaZZaBCm1FAVH8+jNh1Pu5DdjUXQJkstL3 LuD2Vbe6GkBOawNNtL5D7Mpa+kzGa9jlDlJZQGp/IQw8Vjm2Kr78c9YxWikWBe8CroJD cRLLiB90zL7hHGqoVI3vtYoC9IXrhtd5eU7qBhrGgdjAR+XarsXjCMbx8roitQhzIw3w ZQtoFVSU0WBHmYHWfIoCJV23DyoA0huair2U1nBPkXWb1LGLIlMOfoIKuOcDxQGWUuIp 8JXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788226170; x=1788830970; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=ijPMp0aoruOjxz0EUwVJJByK31zD+FexQPaTyeeUmWw=; b=HHBFP69Oazs8aL5fg1FP9T6I5VXu1AOpKXWKOpmY2kxyYsztt+hVm1chWUP1DuldV3 7t/x0IxFmZqMeMsNExKt4DE5TUcZaGq+88JDf5LndtT3rBq16TyLymDYLsipKqjLFyZQ sqK0570OSWV0jMfapt6RVSb3tE2qYLVp7Yms3icVLE40LIZkgNaZuIv8ns5gQgzXB4Sb 0exs/+koVMWRmeO101xs7PlzK7DIduZjc2i4OyVq14sxgFZB3GOHD5R1klX4/av8xQ+U vO2Htwa0nd/v+uhTct7Gd/HUCtH9BOuk8FoWe3P9TWiKRs54EQ7gdU8m7IFwNqD22HT4 RaFA== X-Forwarded-Encrypted: i=1; AKwUvBwsTnQyw1JjkheeGqO6MbVy5cuQhiB2NUyGT5HXDEWpYo2N+fh0NO/V9dnrTZXWf8RB2U5l5mTZkvGLzDI=@vger.kernel.org X-Gm-Message-State: AFuF++m8JGj1Irpytadrq7OIChQ2sI5WxwUz9PZo8bLahXWk+1Guo9/O wR01Qw48LfNvhuEVdmam51m68dsfNBOSsayBt0OlQ2UVgPCbQjWKzk/m90U8MNJbtGU= X-Gm-Gg: AYBFou1zqU1D+mmlkhg+Y88ghk05d5JBT5UG5fJnGuDpggtjXp+ZARZMA7NDgYnZE66 Hm+tfWmp6tINbmdeegQwZvgJR91bXGfEM+bMMUIssf6Ko7mk3SehidrjKEZRuMlFzZZApAb7ODy dWGE6NhrGJ2GfADt37f7cSU1OtR9gSoIajIWJEOtIhwqCzwxWXIkYQoPx5N0iAavlVfHwQoduHe 2Ox6cmyL2zmVDNQP4D8ANYhs/MlIUkHz0CgDdIgOH4UId0dvAOgB7GWRiIHgqQ80n/NNx2qJWgr eltn5p46WMAuYXVS6dc5j5wA3jECpvl0/FrgvkBMdebNj/lgVApRhVInlomr+/s1O6BWE9pjmRC zBQqP7bHr6Qzi+LsXsbxi7FsEzTsSmE8g1/M/V+mTUJoYZd0ZZ25bIpUnefuM2k22nnP/lNMHA4 maVdG4+V4qIp1SOVmrZ6PFE940i3F4foGAoNFNIEpNamWY12jV77chXX9eFGTsGHo= X-Received: by 2002:a17:90b:3c05:b0:396:5cdc:4bea with SMTP id 98e67ed59e1d1-39907ab0955mr6015192a91.5.1788226169561; Mon, 31 Aug 2026 18:29:29 -0700 (PDT) Received: from [127.0.0.2] ([50.145.100.174]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-32b5bef7683sm19390817eec.12.2026.08.31.18.29.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Aug 2026 18:29:29 -0700 (PDT) From: Abdurrahman Hussain Date: Mon, 31 Aug 2026 18:29:22 -0700 Subject: [PATCH v7 04/10] of/overlay: put property on deadprops only after changeset add succeeds Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260831-nh-of-alias-overlay-v7-4-02754604805a@nexthop.ai> References: <20260831-nh-of-alias-overlay-v7-0-02754604805a@nexthop.ai> In-Reply-To: <20260831-nh-of-alias-overlay-v7-0-02754604805a@nexthop.ai> To: Rob Herring , Saravana Kannan , Frank Rowand , "David S. Miller" , Shawn Guo , Grant Likely , Grant Likely , Pantelis Antoniou , David Daney Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Abdurrahman Hussain , stable@vger.kernel.org X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1788226164; l=1741; i=abdurrahman@nexthop.ai; s=20260510; h=from:subject:message-id; bh=npzZe06PtobvJpaMjSbQwwuI2JcJx4uej0mJwKkmuwE=; b=3TJqFcAxk2Dxfh5PddnOWq6tB1A1N54A3Rz65h50plOtgFUybVPiU4pyMG3NqVNXEh+GUV4Lw WEyTLTPXB36CaqXkj3W2Yx+T4hVMuW5xmnVB42u8FEoPnnZmz7ALp8H X-Developer-Key: i=abdurrahman@nexthop.ai; a=ed25519; pk=omTm9cCAbO0ZhS32aKfJDKue0W3sQGpG9ub5eYHif8I= 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 --- drivers/of/overlay.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/of/overlay.c b/drivers/of/overlay.c index 74aea704835a..284c9bc6c9cf 100644 --- a/drivers/of/overlay.c +++ b/drivers/of/overlay.c @@ -358,12 +358,13 @@ static int add_changeset_property(struct overlay_chan= geset *ovcs, return -ENOMEM; =20 if (!prop) { - if (!target->in_livetree) { + ret =3D 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 =3D target->np->deadprops; target->np->deadprops =3D new_prop; } - ret =3D of_changeset_add_property(&ovcs->cset, target->np, - new_prop); } else { ret =3D of_changeset_update_property(&ovcs->cset, target->np, new_prop); --=20 2.54.0 From nobody Sat Sep 26 13:51:50 2026 Received: from mail-pj1-f41.google.com (mail-pj1-f41.google.com [209.85.216.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0E3583AE71E for ; Tue, 1 Sep 2026 01:29:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788226175; cv=none; b=bynum8zCknPxpkHCogO1bONy86mxE/46xvNIXMGIM6cRe9xEIXOG5ZDVXpaZZuKYPUCfYAVFsryYQ4in5Z41ReO3spX+BJ/zA0o2tGHoIdfx66rA4nKCBjK2XD9tNqdOQHiLf2PlZkDvpHFIFXLjmdII4zLSp00qa/cQaYzTjNk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788226175; c=relaxed/simple; bh=ZEr0m0+64zDKVxyN/0o4Ov6n71mrZ2+8QMK6RrzeH1A=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=S5b88kaviHX/JUJ57mbSdaomga6RjyaE9E4M4Lzda9AkaSP0mqdJufAyDsZmncGN0CKOLQOzBLB7RiKZpYK01TOs5RfZxucIfjxVEJ21KBFuIs/1XYQQ3B5Qc/r78Fss1Qxt/tYbC/Hw8gV2OhXiO5mQ3StE9keWlnamxfmL6f4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nexthop.ai; spf=pass smtp.mailfrom=nexthop.ai; dkim=pass (2048-bit key) header.d=nexthop.ai header.i=@nexthop.ai header.b=CyNtx+5e; arc=none smtp.client-ip=209.85.216.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nexthop.ai Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nexthop.ai Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nexthop.ai header.i=@nexthop.ai header.b="CyNtx+5e" Received: by mail-pj1-f41.google.com with SMTP id 98e67ed59e1d1-398c1101c1bso2433246a91.1 for ; Mon, 31 Aug 2026 18:29:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nexthop.ai; s=google; t=1788226171; x=1788830971; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=hBX4D8QE2oULZc7c2LUsXpSCt3UMpyQ0mFmC05VzQfo=; b=CyNtx+5edej+b31Nq+lbzo/25LvgaIkVP56AknZAlQ/TW3i0y5jo4rmfR6qBq4gELZ 7R8guBLMcHzMEbi3DByKayyxFDWFitfS+t83OWa/CLuBwxzhSsr1zDPPcbKDrBvHauB0 0oS58idDmmnnDimxxf4YkplyXFdMgvSGYnDXJ+w0zggAI6tv1fIlbhj2h7OLzZA7RhYO L+yroD6D197Em5Q43Og5Uw0uV0iFe08ro8niCYLWgf5PID7LPZkI3eR8LtwGhcOA57s4 cDQejMjn9l6sA/icaOZ7eyBpB9Fg8A/mSzykyxIJLM2DXjsPs+76C3CtaBPHejPz22io SX+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788226171; x=1788830971; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=hBX4D8QE2oULZc7c2LUsXpSCt3UMpyQ0mFmC05VzQfo=; b=kJIbZe3g9qcFs9ivPzcbxkAfWbbTFPeFK64P5bQivMqrKoQ8J8yp0LtVVpX2vsuPE8 jt1ymIJjiAperuRtkOAWiHkUxNx9IqsUB4ymGP3tm/qTbmX79PlyYOALg1OXq3sHUamm 1oQhVWIh6Cfo0+McW9vc/uhwKYxkhGwREphXG7QA+c2vZUhfIruyPO6cv9cUjgD/2eW1 LPkcjlzkklwdEq2wbjuShXOZ0wOLG64TXNlPfemMAa2zY9/PHp8/J2l2M7jXVjnOYTH1 LOJCyksa3CMaL5PMIXsvX3NG4z2S4QKG3lRinv61aZJQps9E7bCRK/vC6M7whJui5Jbi q6Tg== X-Forwarded-Encrypted: i=1; AKwUvBzLqTCu5gbeNxFb9V5H+5AEGPGgKOw+DQ2GGAT0Fvbov8CTfIZSDST1IeKAm0GTS5w+uAO298nZjNkFd5w=@vger.kernel.org X-Gm-Message-State: AFuF++kmRVKVkdgGyZXBG/dwWXLw8vCzl7dCU5IU+TJZgahEWL7C4CTu 9inrO+LwtHdmvckG4sp0rbbmnC3jN/NaDHHqlQLyOLGVtvECD4UByqS1WTQYm2SFHEioHnZDqJx XaeSc X-Gm-Gg: AYBFou0/thW71TyXatEKPnBVyWQGTTjH+OSyZYLXs6tOAcKzgfI66KM4G4ntX3FsQiS uqhaKUU7NPjQWps7iBKlfR3vAd7uuVq5WrSFKJcFXZu8cBex8oPtL3loaArSOpcbzyExv/h2GCT 0Exgn+ghvhfhHEOtpZXCIVSjtpTNWBxloNrEtiHPRiUxv+C/0E3rA9ZBj9oa28VT/iTc7VuYRty OqnxM+sFFOjFx2TCbkj8VxMPNxbHL2nJ2P5iRVyKzrTa3Mh+0iULcNohQradDD61KiJI8F8v9O5 3/ENiIt2dtQyJFOfschsVT1wP2+8g8LJg93MtnDg8cITABULsw+PWn+Sfb2rSv/nr7Wm+XyGbsX plSLWg36sVRip4rdkIWSv7gtzJ/Rcy+4hgW3Yk7f0jUOakebuzfi3h9bzgw6rFSBYgOmac1AQCl jHmxopy7UAQn+VUq7n6sfePsg2HF8mPgtarDsdoTRQszD4GbyuK2X8rEytkcJzN9I= X-Received: by 2002:a17:90b:3910:b0:398:9beb:5c17 with SMTP id 98e67ed59e1d1-3989beb6373mr27864091a91.18.1788226170796; Mon, 31 Aug 2026 18:29:30 -0700 (PDT) Received: from [127.0.0.2] ([50.145.100.174]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-32b5bef7683sm19390817eec.12.2026.08.31.18.29.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Aug 2026 18:29:30 -0700 (PDT) From: Abdurrahman Hussain Date: Mon, 31 Aug 2026 18:29:23 -0700 Subject: [PATCH v7 05/10] of/overlay: only treat a positive changeset id as registered Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260831-nh-of-alias-overlay-v7-5-02754604805a@nexthop.ai> References: <20260831-nh-of-alias-overlay-v7-0-02754604805a@nexthop.ai> In-Reply-To: <20260831-nh-of-alias-overlay-v7-0-02754604805a@nexthop.ai> To: Rob Herring , Saravana Kannan , Frank Rowand , "David S. Miller" , Shawn Guo , Grant Likely , Grant Likely , Pantelis Antoniou , David Daney Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Abdurrahman Hussain , stable@vger.kernel.org, Geert Uytterhoeven , Geert Uytterhoeven X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1788226164; l=1525; i=abdurrahman@nexthop.ai; s=20260510; h=from:subject:message-id; bh=ZEr0m0+64zDKVxyN/0o4Ov6n71mrZ2+8QMK6RrzeH1A=; b=hOe8J1vYL2U09NmjwTYJSOrQFA7DNmF3EOkLkPXnYsNk+jJbWbFKlsze1cF9Yq0lUHJ8KfHMI 7J0cR1HTouxC43Hs5CV3JfLFr+LvPKVX6Z7V1+3GCJoKm8nCYIdCStj X-Developer-Key: i=abdurrahman@nexthop.ai; a=ed25519; pk=omTm9cCAbO0ZhS32aKfJDKue0W3sQGpG9ub5eYHif8I= of_overlay_fdt_apply() stores the idr_alloc() return value in ovcs->id before checking it. On failure the stored id is negative, free_overlay_changeset()'s "if (ovcs->id)" check passes, idr_remove() is called with a negative id and list_del() runs on ovcs->ovcs_list, which is not initialized until after the id allocation. An allocation failure at that point dereferences NULL. Make free_overlay_changeset() treat only a strict-positive id as registered. The rest of the function already copes with a partially-initialized ovcs, so the error path stays a plain goto err_free_ovcs. Fixes: 61b4de4e0b38 ("of: overlay: minor restructuring") Cc: stable@vger.kernel.org Suggested-by: Geert Uytterhoeven Assisted-by: Claude:claude-fable-5 [Claude Code] Reviewed-by: Geert Uytterhoeven Signed-off-by: Abdurrahman Hussain --- drivers/of/overlay.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/of/overlay.c b/drivers/of/overlay.c index 284c9bc6c9cf..9b9f198a1d70 100644 --- a/drivers/of/overlay.c +++ b/drivers/of/overlay.c @@ -860,7 +860,8 @@ static void free_overlay_changeset(struct overlay_chang= eset *ovcs) if (ovcs->cset.entries.next) of_changeset_destroy(&ovcs->cset); =20 - if (ovcs->id) { + /* a failed idr_alloc() leaves its negative error in ovcs->id */ + if (ovcs->id > 0) { idr_remove(&ovcs_idr, ovcs->id); list_del(&ovcs->ovcs_list); ovcs->id =3D 0; --=20 2.54.0 From nobody Sat Sep 26 13:51:50 2026 Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com [209.85.214.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8AA873B1017 for ; Tue, 1 Sep 2026 01:29:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788226177; cv=none; b=KWPnzMpRMHQvgPAK0ohGiOdQjvA5a52VBFWmP/RfAH8VG2ra46MCgWpeSrJK70zkMr01e2n6apFnTnlj2R/8/xJqDLQuCGYbQ3CCZFZb8phBa/FetROEWYANR8/oC1HOcj016U1ewIEmFMGl3LoRpcM51PWm+vboecmTLn6aceM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788226177; c=relaxed/simple; bh=q9xLMONCbLWdhJ4OaevWw3M/plpvpB4yfOar6DAZZUo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=oNfQ4TDzFbtbjGmGiVCMWhnTYA2Ni22GPka5mnETva1IiXay3y9OfLrPG3/TvADMIYGdGuuUE6htrdsqFcUaT/hHrkDGlC5g54sgdlQl4DPQ5eHGXp0ZVsuUi3SJkuFvEXhM52Hz+hY2PtyxX8ynh+JwTbeuYwFfY2KSHma+rtc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nexthop.ai; spf=pass smtp.mailfrom=nexthop.ai; dkim=pass (2048-bit key) header.d=nexthop.ai header.i=@nexthop.ai header.b=WbkwoeER; arc=none smtp.client-ip=209.85.214.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nexthop.ai Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nexthop.ai Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nexthop.ai header.i=@nexthop.ai header.b="WbkwoeER" Received: by mail-pl1-f175.google.com with SMTP id d9443c01a7336-2d71d1cc8b2so37433365ad.1 for ; Mon, 31 Aug 2026 18:29:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nexthop.ai; s=google; t=1788226172; x=1788830972; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=LEreQw5XOjDLuZe5quRylIWJUa6BEc0yCs3u3pGy0TQ=; b=WbkwoeER0oEcVW9iovAvC5oyWIhUPROM7LtnXhnUscZga9vVePsVwPF3HQL5aN/sws 3xcBTuZ2WdfrU2ZPDxff/6HDhP7ii0OiODfnLlyp/abO/D5ZjPR70aYk6EDVmI2x9N2d kJqnfM/uJ+SaJKgzGvWwfKJTpeB6gmvpIZxW8YLyML0NTeOs8qY88sYFzqN0fvb2mMD4 PU38+K/0ZomACDVDTDksAtKfQx8kVf/t0hMVQV0g7UbTsr5PgmpeBZxzjJ85s4mlbHSS 1Y0U1itxtf71D5hcCj3Hbr6KRmkJukZ+pta2M9ZGPMb0OmbQ5q5v4kg6frQIZ7ldPzld Kbzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788226172; x=1788830972; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=LEreQw5XOjDLuZe5quRylIWJUa6BEc0yCs3u3pGy0TQ=; b=Tfujsq5tW2Y78H0zyVbji7qOI5axz4lnbIjehJf7qE1ghAxRJra8NznS771O+dLZPH HYAzkoplYi7U3fDRteVN5hvRSJOqEe5d0Jnk5ZVQVrRjChjNoC9EZ1qC4ab/uHhiBEqB nooHFTW6GHpoPxgWavYZVab4V40ti3MJhRstnkaNlr969EuYYTM5ed4KuZe0KoRlmGYq tBM9xLZ1pyWpJUQihtIwrnJuDN0yWrIKm9rVDz3hbU+KZvUKHt+zPpyZcTEUx8wHes5r OQPXgrfTXsaSS+Y3kCK6XPTWE3XljyUXzmKFzkeZ/CQnZqzq612txI8GJWacueVFeN19 HA8A== X-Forwarded-Encrypted: i=1; AKwUvBxeD9mDpKefSSb3wFORpd0593YA5Zt0JwKlrGfGRZoDzPUcyUyDIh8NZQeiAKnCER7n8iomajgtkTsh4LQ=@vger.kernel.org X-Gm-Message-State: AFuF++n3XfdaB7W/KDbEYlOP07OsKrOhZUJp6dqXvgFYE2JsSSOvgf2Y rUkEvkzFXzsdvAnmC9CEPfMOZ9i00TfSaE/325VANk1sjU1S2MFrmzxfBCP9aQXkf2k= X-Gm-Gg: AYBFou36seC8qXrQTgE0DiVAwa4fupDGE2aWY7f7sgGb62ECpD9Coe7kIOWc/pH9/Ps LZunAQ/S3pjCVq200LbNJiKliZPW6tLrGLekWZ6EeQqpMZcGHdpGLuQ9FHecIEZ4cfh0TlK7cU6 K8mjZb/nW3RKxTkedGAxu+FIgIC+4lA1POdg2lQHd8jMaQU/mpE5C1TKfw8yvZCkqdVweOqpZha +y91XK6U9y/4i5+i+Th8n3gp7Xvb6ugSkx73ILutjRPgj3Uu+zw1H7KCHxTPPmB4NS/25MPwtl5 xLDcbNnY9l9ioQfgjs54+IByD/Fn1M3ogFuzh3+JO8sxcFEcNd1U6DlUdcCN7DDtIwGmUPin7jf SVmpmzd9+UNhqzi+0cMD4GqT9zezzYYbUbyv+ciLftjBIiudT8QweXoQ2rm/1eWgf7EmNwGhoRK upfL/+f71tTh7nRi2+40Sc1j1+c5jpwnLBJP+se3Q9I/LXwTkk7oI1BIvWyFD1/pU= X-Received: by 2002:a17:903:144b:b0:2ce:faa6:7cbb with SMTP id d9443c01a7336-2d74dc2fe73mr506351595ad.4.1788226171712; Mon, 31 Aug 2026 18:29:31 -0700 (PDT) Received: from [127.0.0.2] ([50.145.100.174]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-32b5bef7683sm19390817eec.12.2026.08.31.18.29.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Aug 2026 18:29:31 -0700 (PDT) From: Abdurrahman Hussain Date: Mon, 31 Aug 2026 18:29:24 -0700 Subject: [PATCH v7 06/10] of/overlay: don't leak fragment references when changeset init fails Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260831-nh-of-alias-overlay-v7-6-02754604805a@nexthop.ai> References: <20260831-nh-of-alias-overlay-v7-0-02754604805a@nexthop.ai> In-Reply-To: <20260831-nh-of-alias-overlay-v7-0-02754604805a@nexthop.ai> To: Rob Herring , Saravana Kannan , Frank Rowand , "David S. Miller" , Shawn Guo , Grant Likely , Grant Likely , Pantelis Antoniou , David Daney Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Abdurrahman Hussain , Sashiko AI X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1788226164; l=1515; i=abdurrahman@nexthop.ai; s=20260510; h=from:subject:message-id; bh=q9xLMONCbLWdhJ4OaevWw3M/plpvpB4yfOar6DAZZUo=; b=L2cOOfGiICvIF9zYrz3xoO8sZHlPz+DiVgGkYsFu0M/jgz5h/QAjfRyiV+hpjZXW7EKU2BSGI MLXOyFCtdATDJuLScYyhkVzJIZjhVXUsU1NdPYcSQ3HUpDpnEUuHXs9 X-Developer-Key: i=abdurrahman@nexthop.ai; a=ed25519; pk=omTm9cCAbO0ZhS32aKfJDKue0W3sQGpG9ub5eYHif8I= init_overlay_changeset() stores the number of initialized fragments in ovcs->count only on full success. When find_target() or the __symbols__ lookup fails partway through, the target and overlay references taken for the fragments initialized so far are never dropped: free_overlay_changeset() bounds its cleanup loop by ovcs->count, which is still 0. Store the running count on the error path so free_overlay_changeset() puts whatever was set up. The store is guarded by ovcs->fragments because on the allocation-failure path cnt still holds the counting pass total while there is no fragments array; everywhere else cnt only counts fully-initialized fragments. Reported-by: Sashiko AI Closes: https://lore.kernel.org/20260805204009.CF3891F000E9@smtp.kernel.org Fixes: 61b4de4e0b38 ("of: overlay: minor restructuring") Assisted-by: Claude:claude-opus-4-8 [Claude Code] Signed-off-by: Abdurrahman Hussain --- drivers/of/overlay.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/of/overlay.c b/drivers/of/overlay.c index 9b9f198a1d70..51241f16e87b 100644 --- a/drivers/of/overlay.c +++ b/drivers/of/overlay.c @@ -850,6 +850,10 @@ static int init_overlay_changeset(struct overlay_chang= eset *ovcs, err_out: pr_err("%s() failed, ret =3D %d\n", __func__, ret); =20 + /* let free_overlay_changeset() put the fragments set up so far */ + if (ovcs->fragments) + ovcs->count =3D cnt; + return ret; } =20 --=20 2.54.0 From nobody Sat Sep 26 13:51:50 2026 Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2A0743B059D for ; Tue, 1 Sep 2026 01:29:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788226178; cv=none; b=IiKyzn/6STTsX8QPaUmM0L7p4phL67qeAb16P6XKbod5LAqp4V4FrWbQS2WZXBH2VAl5XP3K5A2c65dA9vZNSExGiPQh0I/yWkC9S3KUI+/13DQgFbKonbdet0NVUHdswDJpYXz5tiN9l/bZF5C80MSh6GtcHofCJsBRXoD5tlY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788226178; c=relaxed/simple; bh=c8pB9/79+XYKtscBDwUyoyHe2iFW4MM6dHj/rUuEFC0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=VMoEqDib8Dyo1YlY7eLfHbK3RfoD8LM1254JQSjnoPXAdnFlrH7421SfC+/Ts0QP5fQPg2QU/f+I+rDKP1vDQcaXm0naJHT2Q7hoH0ZahtQVGWv3A++dQk5OamQUPZKBYWHlWzUCu4gNEcna15v0+hwVRu5AF5k4IS+3Aij12qo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nexthop.ai; spf=pass smtp.mailfrom=nexthop.ai; dkim=pass (2048-bit key) header.d=nexthop.ai header.i=@nexthop.ai header.b=WXPPZu7o; arc=none smtp.client-ip=209.85.214.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nexthop.ai Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nexthop.ai Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nexthop.ai header.i=@nexthop.ai header.b="WXPPZu7o" Received: by mail-pl1-f173.google.com with SMTP id d9443c01a7336-2caced6038eso5613255ad.0 for ; Mon, 31 Aug 2026 18:29:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nexthop.ai; s=google; t=1788226173; x=1788830973; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=OrWkqhCDRL28YaDgCKIDr3MwV/ILAwu/h+TdmEyaV8I=; b=WXPPZu7o2wmRtOgs3QOhDknZVd2upvzNq/O+SARoPASim1et1fOhCVJDcsVQGu/eRv otUaNKFMbCfi7pGQpFyUw4vqBGDJfHovt/Lu6/el35tiuZlQdiaKY9jQbULyYu89YZib fINsCkbLpYczcLct9RtCkRgA7UbCvpfal700b+eKKA8bVJUg+L9U2PLPdwVuGFuW70Cr 5FVjBgZv2g1f2vJZ0KuywvX1EFlrhQmRX7dl07Yvo++82LCAyKl8fIzGxvyM5yVmcHYA h3X3KZ8tLOedCNfyylitdPLLwWbvM9/91T6mnWm9xwEtdAAXltW1HhDh8HPjPDu8w41s 29+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788226173; x=1788830973; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=OrWkqhCDRL28YaDgCKIDr3MwV/ILAwu/h+TdmEyaV8I=; b=PB8XAS7Ygiree3sqmk2ejWt8N6pie8c4EboJ7bBhAR2vdKOJosnK348VcpBOY5D9ad 6M3/ieBZHikZ0P9Nncjqh8uUKRjn5zJ6Ztfa2RdUBRgBYVQ5Y8EaiGdxmBBaUuPNX4Er pYV/dpGLy+TvzkSPgXi+9KmnjhndgRDxgZQh97ebXKyz/To69xjBIqSqmW4AsIOsydmJ AhnvcVNmyfCWQlA8dE1XIa8fMh13AdBru+UTLwe15FnUK1NgdZdqPpGqbKvWUoiulBGi M4o14MTJ3ApDBGZQ+eDv/nhz4P8WC+Ng3IH3ZqpJV1Vs1k92HJpC8ucXQXJ039D4O0PW O+ig== X-Forwarded-Encrypted: i=1; AKwUvByxZXAJXC9XIyaVedauMXB+NVxGak7scpaYXn6Vbx67P55uwKKluVLvjnJGVC3EZHUjlhTxwlTIw7y7GNA=@vger.kernel.org X-Gm-Message-State: AFuF++m0yJHZTBxN523OmUAkFaPHdfasEzPo/T+F0qoo/RPuUdy2Xu73 4swoR0SWJ8liVgyHtV75mLuZ3IBr7Z2j15pjWebE+4XzeYW+ND4r0KjpFUXN4o4m59k= X-Gm-Gg: AYBFou0X8tR+v+1Az9+mQmd4eUNtm58vNSA5jQ+2T3asPn32v0cgxh0yF64Yk8YdhIo kU8W+5bNk51zvmZ8B1nuyMZUIJH6dhnj2CR1J+RdnZKnseu9EbuFGqqfJ8MpjRv+r+umoiIwPk7 mfChh0yGRwnJOWY87nGz6ojXfFcGNI9Nq+Po7PK6Ud/4UQeRyDVi9g9cIIaRkZLRxWbgVZuvoxG vZYiwvjiF6ABWnydf1QGtx1o3bY2gw9MIpZ7ZyLP6TwU5OUDttfOd3HKioXpe5CTRqlpMhrAeg5 1XVn9pKuOHS8Y9S0Jude7z+AhhH2VOM0g6efn9gWs0VeFFOfEodn8g259GTzwqzVDgi9Z5gSb2b 2baL1UYqrtgdxN14IHmtbTeYAnMX1lPMPg+AFLdBUprDofGdpzh7O+hfAL9Wtms1IPWrCsKeOKZ JD/W53ijQrAn2FZKn18yG5IOgvEbrnqEYsrdL8y7vskqS3fdSZ5lYP7BBZWL4UC2E= X-Received: by 2002:a17:902:e747:b0:2d7:1b20:e98f with SMTP id d9443c01a7336-2d952687ef9mr19828275ad.2.1788226172799; Mon, 31 Aug 2026 18:29:32 -0700 (PDT) Received: from [127.0.0.2] ([50.145.100.174]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-32b5bef7683sm19390817eec.12.2026.08.31.18.29.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Aug 2026 18:29:32 -0700 (PDT) From: Abdurrahman Hussain Date: Mon, 31 Aug 2026 18:29:25 -0700 Subject: [PATCH v7 07/10] of/overlay: don't create "//" paths for fragments targeting the root Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260831-nh-of-alias-overlay-v7-7-02754604805a@nexthop.ai> References: <20260831-nh-of-alias-overlay-v7-0-02754604805a@nexthop.ai> In-Reply-To: <20260831-nh-of-alias-overlay-v7-0-02754604805a@nexthop.ai> To: Rob Herring , Saravana Kannan , Frank Rowand , "David S. Miller" , Shawn Guo , Grant Likely , Grant Likely , Pantelis Antoniou , David Daney Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Abdurrahman Hussain X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1788226164; l=1298; i=abdurrahman@nexthop.ai; s=20260510; h=from:subject:message-id; bh=c8pB9/79+XYKtscBDwUyoyHe2iFW4MM6dHj/rUuEFC0=; b=CHdKOdNJTmjOFM1h9ye84tTbvlftg2IuaS9THOiluVGc7bm3lAnxJj4PH6CAymm5OmpoAaLA/ 7/D10xxlD9IB7kReP5j9yNWsuTFHV/R54It6ZncwaDyjUnbbXWH6G7B X-Developer-Key: i=abdurrahman@nexthop.ai; a=ed25519; pk=omTm9cCAbO0ZhS32aKfJDKue0W3sQGpG9ub5eYHif8I= dup_and_fixup_symbol_prop() rewrites a symbol value by replacing its "/fragment/__overlay__" prefix with the fragment's target path. When the fragment targets the root node the target path is "/" and the result starts with "//", which __of_find_node_by_full_path() cannot resolve: symbols pointing into such fragments silently stop resolving. Drop the target path when it is the root and the tail is non-empty. A value naming the fragment root itself (empty tail) keeps the "/". Fixes: d1651b03c2df ("of: overlay: add overlay symbols to live device tree") Assisted-by: Claude:claude-fable-5 [Claude Code] Signed-off-by: Abdurrahman Hussain --- drivers/of/overlay.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/of/overlay.c b/drivers/of/overlay.c index 51241f16e87b..6f2d7872028a 100644 --- a/drivers/of/overlay.c +++ b/drivers/of/overlay.c @@ -256,6 +256,9 @@ static struct property *dup_and_fixup_symbol_prop( if (!target_path) return NULL; target_path_len =3D strlen(target_path); + /* a root target renders as "/"; drop it to avoid "//" results */ + if (target_path_len =3D=3D 1 && target_path[0] =3D=3D '/' && path_tail_le= n) + target_path_len =3D 0; =20 new_prop =3D kzalloc_obj(*new_prop); if (!new_prop) --=20 2.54.0 From nobody Sat Sep 26 13:51:50 2026 Received: from mail-pg1-f182.google.com (mail-pg1-f182.google.com [209.85.215.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AB29C3AF65A for ; Tue, 1 Sep 2026 01:29:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788226178; cv=none; b=GLsPJiBPqWqdKN+J+aPvig2F+JPxitfITESD7QtCD8Xgj0QRckqArP+ZNxpthozy+ncjD772/menFHzKuirSWFro3rMNNAJDc5iikE86tELe4M0agkC6XWRkvODOgI7HF8HDOJAmbf7HAhBULsIV38XcOn+iuWJDmQ+F8SMRb0Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788226178; c=relaxed/simple; bh=acOJS8se6Bn7H5ej5P3wKdM0zO0DOnFCnriESzJEpQE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=skjqi91FwdkK5iZ+jFnw4WkJrXim6TOyJDEbvz32mnbPCoY+IXSCB90MeA/lpyFR8D9zb46+GLOIM6Bxz9b+YqmExYU+Z6m1VlFvv4I2TKfYKOAABFMRQUE24MrrL8uNRsovJpA8ISpEB1ZVFErmBP0zfiCNzjeamALUSGK/XZQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nexthop.ai; spf=pass smtp.mailfrom=nexthop.ai; dkim=pass (2048-bit key) header.d=nexthop.ai header.i=@nexthop.ai header.b=OPJo5cs4; arc=none smtp.client-ip=209.85.215.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nexthop.ai Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nexthop.ai Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nexthop.ai header.i=@nexthop.ai header.b="OPJo5cs4" Received: by mail-pg1-f182.google.com with SMTP id 41be03b00d2f7-cc1cbb64a1fso4079445a12.1 for ; Mon, 31 Aug 2026 18:29:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nexthop.ai; s=google; t=1788226174; x=1788830974; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=Ma3PelxrCs1dceTiy4AcSJOVkhz7U1Hwxq7XQ/KQJhE=; b=OPJo5cs4yuomqyProIj4iKk8jtZmrApYS57xkjMSVzbg86dvleLFR7rk5/lnBGNpB7 ec0H0VA3+F8kWPAIGXwWfCFp7Dc7i7o5S71hpiR9zOEWx25Mwqn2H3xTgexQ8BaUJ/4i 7lALu/MPb34kwxJl6MHcrDlcDfwLRblJ6W/+m7reZLi3nAr9ssCHWC2uHe0clgfXAI06 VZP5ZlnXdAZ5NK0pJUc8eGg9mHOsmaIZQ9sXHwahbKWg6RrFmDxLGvz6JUTSIrdLar8u hpXKvXhYHAptZf0HuymL5eM+1dQJpoJ04bqW3Rky3x2jkD+N3odbs5PTh4bDb+faSLX5 BrGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788226174; x=1788830974; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=Ma3PelxrCs1dceTiy4AcSJOVkhz7U1Hwxq7XQ/KQJhE=; b=AyE2Q3w6xyO5TOims3hDfcLsehuYzxS9fl9Vo7qfLP07iozcr93gn4MVSEK+aJQTQT P2nT+tFMLOCeDHAhw4ZMmIyFEEuhaDvkza7VI7FDFHP9kdxlJ/YgROn9AxNi+3bSjomR 2m++TNA99BJBalsOoOg5EAx3BeKWWU7UwMRZGFpeTxwWJsN/mTw1Yct7Ov4mYsnpDe3R Nhl+Wv2GfKjJqtKWcIpucXCJYHC90rkrwt3d/e899PL5cjSmN3+qYzaepyP3az5jFM/5 fJiclcGtCqnmThRHQhRhBI1flojczYG1LNdy3aERjZHqpPbSblSstxsj6GUvdcI/dtKQ ZUwA== X-Forwarded-Encrypted: i=1; AHgh+RqZHKSv9T1Pv0F+8B/mtdks/59QaStFlVJo4VqMdlJFTFc1d8iU2EqdfR5mEOOGFcn6KG5PDk21NJJxmHY=@vger.kernel.org X-Gm-Message-State: AFuF++lWhE5tP8G4o2mlAHIKIDy90/qGWQZFAGDVz2e1Q4H0CJQGSTbQ bxe3B3Lz8Hc7Cd9tmq5LJBCT2k5Tk2Phbhwh8bl30kZdMcqDudZ4jbQV14xP+jdiFXs= X-Gm-Gg: AR+sD11+UvY+emmuCdhqKv6XVsggqRIGanlCqmkrkw3pzKYmd4qCyIQVsHK6jFijXMU ilD0EMOQry+WVlqCLL/F0TZb8GCgolxmES8uIFEVu0lSIO9wQj01YoOPCJEPOIZx+aenlmU+/ls oOLM+THQMbuSdmKrL2o5CFObkNCFWSIj4Uf4+bDrQf/B41ViijRV/58TE7VV1AVKhARj4EFXUvK 6Eh5bm+Ue7n84ByEA+CUsZFgtdrxRxsrRvW7el0+H4bpJrhvX21g0NW9B1z4n/jnK2B31kFV7Zh DVn1rja8zvtISwZsTURFcZfQrfL4tGY6mUOvDFNV0Y8hCsmKla16PX8Yaz4vNe320Nj1x8RydQj w+X9TOhworzIXxyGZTSvMG+Q/CEUYoboWaMtxQ/G7qqRByCJpfd2n5KhaLLE532C9EVqrewESE8 Se2BbcpVpV3+P8uTOMFHERP7B6fRE+ykWKQTT6GA/jcAlLLN0LPDHCIEZaATqI2GE= X-Received: by 2002:a05:6a21:3947:b0:3d3:ae40:51e0 with SMTP id adf61e73a8af0-3d3ae40563cmr34941450637.20.1788226173716; Mon, 31 Aug 2026 18:29:33 -0700 (PDT) Received: from [127.0.0.2] ([50.145.100.174]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-32b5bef7683sm19390817eec.12.2026.08.31.18.29.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Aug 2026 18:29:33 -0700 (PDT) From: Abdurrahman Hussain Date: Mon, 31 Aug 2026 18:29:26 -0700 Subject: [PATCH v7 08/10] of/overlay: return ERR_PTR from dup_and_fixup_symbol_prop() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260831-nh-of-alias-overlay-v7-8-02754604805a@nexthop.ai> References: <20260831-nh-of-alias-overlay-v7-0-02754604805a@nexthop.ai> In-Reply-To: <20260831-nh-of-alias-overlay-v7-0-02754604805a@nexthop.ai> To: Rob Herring , Saravana Kannan , Frank Rowand , "David S. Miller" , Shawn Guo , Grant Likely , Grant Likely , Pantelis Antoniou , David Daney Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Abdurrahman Hussain X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1788226164; l=4363; i=abdurrahman@nexthop.ai; s=20260510; h=from:subject:message-id; bh=acOJS8se6Bn7H5ej5P3wKdM0zO0DOnFCnriESzJEpQE=; b=F4s/DIjXalAldRlKbPPw41masS2dqAOkIG255BI9qGHyGIcfKYPHYIjxmyTmx7RR1hYqm4r8W 74ejSJE3Y3QCY0FiP1WX4W3VBpl8JWqdwHZVHBEaWzFo2prFnXh0RUz X-Developer-Key: i=abdurrahman@nexthop.ai; a=ed25519; pk=omTm9cCAbO0ZhS32aKfJDKue0W3sQGpG9ub5eYHif8I= dup_and_fixup_symbol_prop() returns NULL for malformed values, for values that are not paths into one of the overlay's fragments, and for allocation failures. The caller reports all of them as -ENOMEM, so a structural problem in /__symbols__ is diagnosed as memory exhaustion. A later patch reuses the helper for /aliases values and must handle the three cases differently: copy verbatim, warn, or fail the apply. Return ERR_PTR(-EINVAL), ERR_PTR(-ENODEV) and ERR_PTR(-ENOMEM) respectively and propagate the errno in the /__symbols__ caller. Also verify that the value descends through the matched fragment's __overlay__ node before cutting the prefix. Only the first path component was resolved, so an absolute live-tree value sharing its first component with a fragment name was sliced at the prefix length and rewritten to garbage. A prefix mismatch returns -ENODEV. Assisted-by: Claude:claude-fable-5 [Claude Code] Signed-off-by: Abdurrahman Hussain --- drivers/of/overlay.c | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/drivers/of/overlay.c b/drivers/of/overlay.c index 6f2d7872028a..bc0c879dd807 100644 --- a/drivers/of/overlay.c +++ b/drivers/of/overlay.c @@ -206,6 +206,10 @@ static void overlay_fw_devlink_refresh(struct overlay_= changeset *ovcs) * The duplicated property value will be modified by replacing the * "/fragment_name/__overlay/" portion of the value with the target * path from the fragment node. + * + * Return: the fixed-up property, or ERR_PTR: -EINVAL if @prop's value + * is not a valid non-empty C string, -ENODEV if it is not a path into + * one of @ovcs's fragments, -ENOMEM on allocation failure. */ static struct property *dup_and_fixup_symbol_prop( struct overlay_changeset *ovcs, const struct property *prop) @@ -217,6 +221,8 @@ static struct property *dup_and_fixup_symbol_prop( const char *path; const char *path_tail; const char *target_path; + char *overlay_name; + bool mismatch; int k; int overlay_name_len; int path_len; @@ -224,14 +230,14 @@ static struct property *dup_and_fixup_symbol_prop( int target_path_len; =20 if (!prop->value) - return NULL; + return ERR_PTR(-EINVAL); if (strnlen(prop->value, prop->length) >=3D prop->length) - return NULL; + return ERR_PTR(-EINVAL); path =3D prop->value; path_len =3D strlen(path); =20 if (path_len < 1) - return NULL; + return ERR_PTR(-EINVAL); fragment_node =3D __of_find_node_by_path(ovcs->overlay_root, path + 1); overlay_node =3D __of_find_node_by_path(fragment_node, "__overlay__/"); of_node_put(fragment_node); @@ -243,18 +249,27 @@ static struct property *dup_and_fixup_symbol_prop( break; } if (k >=3D ovcs->count) - return NULL; + return ERR_PTR(-ENODEV); + + overlay_name =3D kasprintf(GFP_KERNEL, "%pOF", fragment->overlay); + if (!overlay_name) + return ERR_PTR(-ENOMEM); + overlay_name_len =3D strlen(overlay_name); =20 - overlay_name_len =3D snprintf(NULL, 0, "%pOF", fragment->overlay); + /* @path must descend through this fragment's __overlay__ node */ + mismatch =3D overlay_name_len > path_len || + strncmp(path, overlay_name, overlay_name_len) !=3D 0 || + (path[overlay_name_len] !=3D '/' && path[overlay_name_len]); + kfree(overlay_name); + if (mismatch) + return ERR_PTR(-ENODEV); =20 - if (overlay_name_len > path_len) - return NULL; path_tail =3D path + overlay_name_len; path_tail_len =3D strlen(path_tail); =20 target_path =3D kasprintf(GFP_KERNEL, "%pOF", fragment->target); if (!target_path) - return NULL; + return ERR_PTR(-ENOMEM); target_path_len =3D strlen(target_path); /* a root target renders as "/"; drop it to avoid "//" results */ if (target_path_len =3D=3D 1 && target_path[0] =3D=3D '/' && path_tail_le= n) @@ -284,7 +299,7 @@ static struct property *dup_and_fixup_symbol_prop( err_free_target_path: kfree(target_path); =20 - return NULL; + return ERR_PTR(-ENOMEM); } =20 /** @@ -353,6 +368,8 @@ static int add_changeset_property(struct overlay_change= set *ovcs, if (prop) return -EINVAL; new_prop =3D dup_and_fixup_symbol_prop(ovcs, overlay_prop); + if (IS_ERR(new_prop)) + return PTR_ERR(new_prop); } else { new_prop =3D __of_prop_dup(overlay_prop, GFP_KERNEL); } --=20 2.54.0 From nobody Sat Sep 26 13:51:50 2026 Received: from mail-pj1-f52.google.com (mail-pj1-f52.google.com [209.85.216.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 258A33B3BED for ; Tue, 1 Sep 2026 01:29:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788226180; cv=none; b=oLqQsU+HDVaphScSCEnZ1mX4p5ux4V+j/N3osu3pOndem4Rds8szjG533yHwtwBRfrNGiInYY9ocN5X8d5p1y+8zgaj8qx9CGv/sN0M8oo3L2azUfzAXn8DHZV3DC5+ui4ICq4u9HRepDmPw5fwTJaicHjDUQkruzG/JgPv1buA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788226180; c=relaxed/simple; bh=gghIcfA0E5etGc3q/zBB+/m+pufUJ9ndp76omnr8Zck=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=R10ShAOoUeubXLBLx9yOGtrs8rQq+wyMKFBSoBK7Z6jOLePrCYRn9k/mIV2XAzmGGdzrLCL4GSSRMYPDeYvP0MJRNa3LgJhWOJfNG7b89sDwQpHXYnnnRdraCUGLgWi35KlaWf70FyJ5eP6B4c42uW84lNj9x/UFQgFcQLBK+FQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nexthop.ai; spf=pass smtp.mailfrom=nexthop.ai; dkim=pass (2048-bit key) header.d=nexthop.ai header.i=@nexthop.ai header.b=RsN+lLaL; arc=none smtp.client-ip=209.85.216.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nexthop.ai Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nexthop.ai Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nexthop.ai header.i=@nexthop.ai header.b="RsN+lLaL" Received: by mail-pj1-f52.google.com with SMTP id 98e67ed59e1d1-38e58034d05so3520967a91.2 for ; Mon, 31 Aug 2026 18:29:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nexthop.ai; s=google; t=1788226176; x=1788830976; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=/l8H8s7+Ljb2oSYjq14mfIjexLlHVwt32RckwPqIL50=; b=RsN+lLaLeBqapFumfi3FxEEU3RQVVsETFnHJAYLFJ0vZn0yGQWxmynMxPMQ2mtPawD grEv8hXh5XR9P//P8EkxgTanMMoey3Tgaa2Nn6PYy9TcmUHUGmZNqCBJiv8dThVt2Yr3 iingkF5T5s8vFxtAPPgjz8pzT3Ehhu0/rcPb1LbLBi7wHTO8NrL/j14izj/cT+X8LTZR vhh5FR0AKERZykP1Iqjk3oHKKk4gq2zj8rOqM20MF1Hd3mMws9O9y/I5H1efDL5JaHnN ZDiCZAqzrIVkePF07AcYbCGfVADomfc5UTUPe8yCVOdQ7TUst4E5ME1ozx6GmDumKAA8 AOtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788226176; x=1788830976; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=/l8H8s7+Ljb2oSYjq14mfIjexLlHVwt32RckwPqIL50=; b=jjyR6uOOLxfBKCLZzwjNdNIP2hNdinwIB0W+opmyV2rtzqAdChTNCCAwrst6m3Lfz/ cvJJYrsBhOUoOwZoom//PPJjisfCuHjei0CMHJDQEkUoowlxa6vyc9kYNCmftMfiSZM/ GGgLDtHLhxTbrnwje2ZvYwOp8aJ6rQdMD7pB4HHm67Co91BTw4r6g950TEhbjUWYqhzo Y2wrYheZwei9i5whi2Om+3WMBs3BUL2DchxE54jA8b+gYvc3Q3YTP/BuewXNlptr+vxx 4XTmG1CvRsryoT0NbzqS4bBdX74K2mVZIeEQhsxifem97KBo1eAg8wOmhfqb6UqDCkN8 8PQg== X-Forwarded-Encrypted: i=1; AKwUvBy3AsxUJj1aI7QibwMx1IdBtzBkIKodVTuKjKJV+fBK59ED49nbO5hSwHj+zGAIfUIyIFemFjf6JcFNlvE=@vger.kernel.org X-Gm-Message-State: AFuF++l3yLoaEH3iVTbs4VzDS4UcCOw0Jq7tbQ5SesMYmrL5YLIzNsZ6 Q7FEv5iHkBlmUL7TolRkcayFv2xABzWBrW5UcIH1G3dLttIs/C5Mfl/a7NFrwguYdu4= X-Gm-Gg: AYBFou2JkWu1Oqq5rA7DiY+AY3u0BFY+SGtzXB/ZGBsWysdCOC+4AyFihkQBAIWcuyZ mz1VkoXBo3s4nTrFZAYOmp5lGsA0eAPsU6/f5UM/NyvQmEEB+P9CsMZbg0/7BwpdkTNG+8H0v1s PwbGoMeATvl7IHUbvNhLdWkge0/LXljy/ujWwf2XX0W3jzHnBVvERtkm3Misp4x1jj43GvDqKoM N7nGtRM/3j9+RxxPa8u/shE+pCEBYj6wmFii0l1sqe5RLeFUKPBSRBG87BJY0sXjl0eCOXI+f4T QPHnpUMkUOfEV9z2Jf1VtvukYNkoeMTx+afx8Pwzxh/TEvXTu8QCT3ZXfYJYraKjEdW38v/srE/ ke4QsnPQhhZ86K1elesepzYf2l1iucWRRqRS+4aYwNE88iRzVn1MSKbWulThILi/UBP4sNadfxt AJxCvNCKHhX1hK1Kr/Lm6VAfAUF0sNOl8EYIzImyC2WJJjow858NhVWfxKufKB13g= X-Received: by 2002:a17:90b:17ca:b0:395:4de5:1054 with SMTP id 98e67ed59e1d1-39907d65648mr5286523a91.16.1788226175501; Mon, 31 Aug 2026 18:29:35 -0700 (PDT) Received: from [127.0.0.2] ([50.145.100.174]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-32b5bef7683sm19390817eec.12.2026.08.31.18.29.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Aug 2026 18:29:34 -0700 (PDT) From: Abdurrahman Hussain Date: Mon, 31 Aug 2026 18:29:27 -0700 Subject: [PATCH v7 09/10] of/overlay: rewrite /aliases path values to live-tree paths Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260831-nh-of-alias-overlay-v7-9-02754604805a@nexthop.ai> References: <20260831-nh-of-alias-overlay-v7-0-02754604805a@nexthop.ai> In-Reply-To: <20260831-nh-of-alias-overlay-v7-0-02754604805a@nexthop.ai> To: Rob Herring , Saravana Kannan , Frank Rowand , "David S. Miller" , Shawn Guo , Grant Likely , Grant Likely , Pantelis Antoniou , David Daney Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Abdurrahman Hussain X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1788226164; l=2368; i=abdurrahman@nexthop.ai; s=20260510; h=from:subject:message-id; bh=gghIcfA0E5etGc3q/zBB+/m+pufUJ9ndp76omnr8Zck=; b=aCAARdMYQw95Hss3hPDMbX1z0tIcx67W6xf675nR/F0vPSDepbn9Y5hJ0ZsoKHtw/hg7vNjic DG27SRu1ydsDGyTZpUoEmJD8BvsUvjJt/Fw/gbSRN0XqNo7qhoyyujv X-Developer-Key: i=abdurrahman@nexthop.ai; a=ed25519; pk=omTm9cCAbO0ZhS32aKfJDKue0W3sQGpG9ub5eYHif8I= An /aliases property added by an overlay references labeled nodes as "&label", which dtc renders as an overlay-internal path such as "/fragment@1/__overlay__/i2c@40000". The value is copied verbatim into the live tree, of_find_node_by_path() cannot resolve it, and of_alias_get_id() keeps returning -ENODEV. /__symbols__ values follow the same convention and are already rewritten by dup_and_fixup_symbol_prop(). Use it for properties of the /aliases node too: - a value that resolves inside one of the overlay's fragments is stored rewritten to the live-tree path - -ENODEV (legacy string aliases, absolute live-tree paths) is copied verbatim, as before this series - -EINVAL (not a NUL-terminated string) is copied verbatim with a warning; consumers validate before dereferencing, and an overlay that applied before this series keeps applying - only -ENOMEM fails the apply Pseudo-properties are exempt: the is_pseudo_property() check at the top of add_changeset_property() only covers live-tree targets, and a phandle of a newly created /aliases node is a cell, not a string. Assisted-by: Claude:claude-fable-5 [Claude Code] Signed-off-by: Abdurrahman Hussain --- drivers/of/overlay.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/of/overlay.c b/drivers/of/overlay.c index bc0c879dd807..2af9ffb08691 100644 --- a/drivers/of/overlay.c +++ b/drivers/of/overlay.c @@ -370,6 +370,19 @@ static int add_changeset_property(struct overlay_chang= eset *ovcs, new_prop =3D dup_and_fixup_symbol_prop(ovcs, overlay_prop); if (IS_ERR(new_prop)) return PTR_ERR(new_prop); + } else if (!is_pseudo_property(overlay_prop->name) && + of_node_is_aliases(target->np)) { + /* rewrite overlay-internal alias values to live-tree paths */ + new_prop =3D dup_and_fixup_symbol_prop(ovcs, overlay_prop); + if (new_prop =3D=3D ERR_PTR(-ENOMEM)) + return -ENOMEM; + if (IS_ERR(new_prop)) { + if (new_prop =3D=3D ERR_PTR(-EINVAL)) + pr_warn("%pOF/%s is not a valid string; alias will be inert\n", + target->np, overlay_prop->name); + /* not overlay-internal: copy verbatim, consumers validate */ + new_prop =3D __of_prop_dup(overlay_prop, GFP_KERNEL); + } } else { new_prop =3D __of_prop_dup(overlay_prop, GFP_KERNEL); } --=20 2.54.0 From nobody Sat Sep 26 13:51:50 2026 Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 53F333AFCE9 for ; Tue, 1 Sep 2026 01:29:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788226180; cv=none; b=QlEfq1t/TVOff4wRADlvmaGQL1d+WPTDzDY+oCPxwGD+88Jp2/CQ/N1SvicHTI9YMz1Iempj3UZk0AtuU/OOpi6v92WI76V5wbp129TI4eARiRuY99QDnBGLvlEcURaW55L4Ud20Np4ALLp6j4VcJC75cIZp0QnaK/Ks3EzKgMU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788226180; c=relaxed/simple; bh=rtMHX9hWMpcieCzh+lEL0bv+hah6KKo01VRR5TnIRxg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=dqPHA8r7Lvc35m0oR0bkgl/4BaH1Gs1zGR9565Uqz4Wg3pthiYJPhTGMRKKjAM8N6NGeqhXW3r6EOl/X70xmOmiuUTz1he70ueJImUzRRFkFNrt80PHhoixpwOWzqih8IEBHjUo85tFxV2ntNg3m17NNPgU0WktDhjy8tSUrJgc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nexthop.ai; spf=pass smtp.mailfrom=nexthop.ai; dkim=pass (2048-bit key) header.d=nexthop.ai header.i=@nexthop.ai header.b=kYb5xAwN; arc=none smtp.client-ip=209.85.214.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nexthop.ai Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nexthop.ai Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nexthop.ai header.i=@nexthop.ai header.b="kYb5xAwN" Received: by mail-pl1-f178.google.com with SMTP id d9443c01a7336-2d560775ca2so30154665ad.1 for ; Mon, 31 Aug 2026 18:29:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nexthop.ai; s=google; t=1788226176; x=1788830976; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=OBfNFbSVh1FYGWwWZzjs3Er9OcgI7SYTXtrFRcmH5Do=; b=kYb5xAwNwhiWSNbH6RfuzP1WB82NHbnhZvRiWJrSfq9wRdg9XH7d9atueRuZtUCtc7 xLnZI5/AVQ10F6gRIXC8S4GlE0/tnBrem4ji5+0Ho/wv9YJOZqwJLiqU4C7uEGuLd6eE JjDrR/kspf/97DGsgDYF4PnSrxVHmxVHA8wp0zh6vDykoBAZN93KcAjwsUbxa5NZJxZO 3Fim8kP5WxoxfHOZyW8IoqmsfHez8hXiNuQkf16463Yl1D4QCve607DqZu/uBJgyKx5J XMfK+hEG5qAzr9p/eWYcLwiowb4fInhedQXmPjolsNaE77FuK293cdpm8n9VJZ3pBA4V L7HA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788226176; x=1788830976; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=OBfNFbSVh1FYGWwWZzjs3Er9OcgI7SYTXtrFRcmH5Do=; b=I8EWRE0cI0eu90SaKnOH7XzMct8XWkoS2XIGDWqMcbOXU497ZI11U4AV9U6+KFkfj5 sLQTgMgBLwFvxTCecF5+GVhmEQnAN2pJaBP81crL1Tm8M044XWm8FTY+cnNvUiaFShKi qDNJ3oB1qqO7boqLLuccUCn7VP5or+YFPXRKFR600oPCnRB0cZ6g2RK4VLJegLefjc7P VPBOY8u7xIvybFhgLs0AG52JXNhDKuRLRBug7ToyyaUmw+OGSQW0jl3tybd6jecwQ9Tm ubihcirVULTVIUCuZ75VX3ulRaOTNOf2G3PbXa0ujMlcu1MlgD2qeTo65MptpQ4fvnmw xPqw== X-Forwarded-Encrypted: i=1; AKwUvBwjkw/cshgtu07OEBCaSjyiXEpeCXSdAyHgaI/JDiP/lnqSIwoo++iMvhS0weO7LjlVeA8vA8UmGMiWaBQ=@vger.kernel.org X-Gm-Message-State: AFuF++mvD1TemmBio/fsp5OCZC9RHBt5vRmH28HyEPxp00GHYFP0khYk o3wHzRhKfvhtKibQL1+6fu+4ZXajo2Z+5g9ySbxnAWbYRxBC7U/JK6Pd+fa/D3FYZN0= X-Gm-Gg: AYBFou2+zp5AWRcLJdcsGyFDJNbBsMj/aZMfIRLkHL1QBiHj3uG8pA6sclMb1pF/6kr U0M3pxNs/IHBpifRGWsuUssXFLfk2ACK2hMkRbaSwZ1naPUnSI1wpuJrlWq8wcCl6libQgDpq3r 3EMV+zvFXHxA7xy6fM0zZqmZZvvN9IEN8a+JhP/v6xtclpKZSeExW7neEfXS0S8RsodaJCrKjHn epzwb+vxhTqSAi2Jvt/QFihFKNDepoYf2c89sVBOsLuE+zJGestWgfKCT8N0QCo2W86uhYAopf6 YWnm6WUzz7aJ19Hp8E6RVP7jIP4Ur2a3dCrOssTbH8BbMzvZI2UvJgsimfs++jsy80aG2UIOGcr 4Xqt9dED9EkNpbkbaI/HzUDMYH3CRv1VBGOIgiTdHFN0bRu9XJ3Jv+gUmNbfEYfcocUCbfpbraQ 7EQLS97/BkgFptg2ZD82+OqF8p7Cch1OMnFngsNB07GjSki0URNSOyugtC29BFHC0= X-Received: by 2002:a17:90b:538e:b0:398:e436:384 with SMTP id 98e67ed59e1d1-398e436066bmr15420705a91.1.1788226176534; Mon, 31 Aug 2026 18:29:36 -0700 (PDT) Received: from [127.0.0.2] ([50.145.100.174]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-32b5bef7683sm19390817eec.12.2026.08.31.18.29.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Aug 2026 18:29:36 -0700 (PDT) From: Abdurrahman Hussain Date: Mon, 31 Aug 2026 18:29:28 -0700 Subject: [PATCH v7 10/10] of: unittest: cover /aliases updates from overlay apply/revert Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260831-nh-of-alias-overlay-v7-10-02754604805a@nexthop.ai> References: <20260831-nh-of-alias-overlay-v7-0-02754604805a@nexthop.ai> In-Reply-To: <20260831-nh-of-alias-overlay-v7-0-02754604805a@nexthop.ai> To: Rob Herring , Saravana Kannan , Frank Rowand , "David S. Miller" , Shawn Guo , Grant Likely , Grant Likely , Pantelis Antoniou , David Daney Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Abdurrahman Hussain X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1788226164; l=6079; i=abdurrahman@nexthop.ai; s=20260510; h=from:subject:message-id; bh=rtMHX9hWMpcieCzh+lEL0bv+hah6KKo01VRR5TnIRxg=; b=1ks1iRYQYcQtQ1N6ZJWYSjrYQAUhUHbg276RixnPKvUgh+nbWCdPj7jPYkzMYMVpZ1S/O1na3 Vz+nrvcgLTeCJiwT9Re7r0Sq93Do7kzjil2FU+msI5bnZ2zQR33puwL X-Developer-Key: i=abdurrahman@nexthop.ai; a=ed25519; pk=omTm9cCAbO0ZhS32aKfJDKue0W3sQGpG9ub5eYHif8I= Add overlay_alias.dtso and of_unittest_overlay_alias(). The overlay has two fragments: target-path=3D"" grafts a labeled node under the run-time target base, and target-path=3D"/aliases" adds `testcase-alias99 =3D &