From nobody Mon Aug 24 05:05:29 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 BBED63D47C0 for ; Wed, 5 Aug 2026 20:31:09 +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=1785961871; cv=none; b=ajTTdSK+4F7zd0oKoQ2k0DE+JQoEKFOSM0F5lRYjUec31qTCqw01Jqfdmgas02frHH7xu3KU5UYCt+cO3lkcn5n+92nwrP2Q/A/KjlAY6IJdVR7y7uc52wFVFuYdRdu089NFLI79MKjAOyCJMtPcdwDwY0brkAYAJrKQcS5M8Q0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785961871; c=relaxed/simple; bh=kN1eUXhzlmZ/uTG2/7ewWsiGSCgf0wXwrMYNI8HvUbw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=FlSak1VMZ73FZVzPZjaaEoKGwcOL+ayxaqKXgCewj2iLb0oy10QDJPvloQqX6rQbjl1062Dwpv2cnkhLVplJAasm9M9icqpEUhRfkBkkyhKH7VKgPHfP4APt5plG9btl2ZppuKlrfI2na+Xout5Qp6ABDXoMjv/73PLjvtbcQ1I= 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=gGSbP4YZ; 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="gGSbP4YZ" Received: by mail-pl1-f179.google.com with SMTP id d9443c01a7336-2cc61541f8cso3292865ad.0 for ; Wed, 05 Aug 2026 13:31:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nexthop.ai; s=google; t=1785961869; x=1786566669; 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=1LalWexc+0F8HjQc4krojZh1ADM6i/G7+RWOPIo9azY=; b=gGSbP4YZKvDYRYE5Zj86Eztn85IThpLFh7ghTOjMzg9e4k1NjRV9a7tdHvhPfriHhY BsNjahW6fF/z3UbCcltGej58XO3KQ+5KrE5Xp2GA3btamwAF8bxSo/Q1bgp2tZFlreqE 0jm75XPsOXk9FaOfPGjWYbeh1mgMPAGxf5OAWJJLAi6LagxhXtzruGWYzqbfL2C119M7 sSRiGmTUyzlGIRSp5OC2fusu35jV1U72gNq1IZafE+0nYJYLUk3cAD9E5nwwWCWGfQR0 MJy82hS9hmHdlZ7/uac50y5uEfAfmvVUqCyDOcWQsjHWFW72v9eM7E1MZo7B7LmZz0Pm X80A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785961869; x=1786566669; 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=1LalWexc+0F8HjQc4krojZh1ADM6i/G7+RWOPIo9azY=; b=Hz7FK3Lc8FDVboPRYzhnyYjsZVezUkg7xZORiPAeZR0T2T2sY52wzmSmUfAFgzTWgC ixqhTarclZW+JZh7JlLlgPnQ6JazMo5IR34CUUlXdjy5eoiE8TRfj0pduOoQfNkrhd1c /uFBQaXtSYPQnbBJ40IcuV4gVGJBr2ImC98+Gcq/ov0R5V8bnvRdM2E5CiDwPMQ9W2nt NxNFPsuSrvUDUV9qJ6+sYm6nQTnGA3GuJOERT1xtzHvu6YYvQuQL1ClW4gDXx6q1otco 84mUDSt2BzfYtX49W4NSaoT/G4oFpxKuTxBMLy5VYrJ9yNmHtqRq9S4iGDj4fWsliXkj 1tNA== X-Forwarded-Encrypted: i=1; AHgh+Rp09pI+c0vC5Tb4kyuoQ/G1L6DubBg63jLwcyif1S7W6UcVyzITlAISo12IZihrqRRQakc04eM+7RdH81g=@vger.kernel.org X-Gm-Message-State: AOJu0Yw6abzVrbhZ1DGL8RQRZ04exd951Ii5jk5f7Rn8b9XJDVbQpTLd dTb7xggVsBwAZ05aVk4Pk4OxfVLeyl4JHVqJbxlWdZA+G/aa7+1DQSD/lGkyCFAwyMQ= X-Gm-Gg: AR+sD10uXvzOI5MzpVfC2Kp3PImlKquPRvDzFW5cPt7L7xpDW+cLH7Iw6QSAwWVrpEB UCBI2WTNV1oFiLxgG+n3rzZcYW+q1eoeUbCBKn8no+12eYlGPk5hWffnNNiNSQcNk3uNOEffpCx iZlG+6x9IDVlcoDfWl9gffLkQsx0m5mXAx40KOMDTsEizSO0/3A6KuQWutzGN2ctlT82z/P5nq5 JLYs1fjcG6tz3Byfba1j9v5Cv6WxETTxvD/fXHPYqJwlJ6QjUE0wmYg5Ki1O2+G1vge4jK6WmP8 xXffRf5U03MCzU5jOPHuPCRa6Ji/uWbEo1x2IVJ9wlwR9Dx5wqyxeWRDi+lD7vF5aZ5W/OvRyxJ s9grXWwFPkmoLtuGU4B0pHsTWEipTwLZfuFSDDCzVfFA5V1KiNTjsqHLpBZh9LWYW91ntL+niny 3L9qjV+GgBzhZRoqZes0CmhGbAFzsaf5QCFvSqQbNUeOdoFs6zLmXxi1KAc2HRkUM= X-Received: by 2002:a05:6a21:2d4c:b0:3c4:320a:737 with SMTP id adf61e73a8af0-3cb9c2376femr2136084637.16.1785961869014; Wed, 05 Aug 2026 13:31:09 -0700 (PDT) Received: from [127.0.0.2] ([50.145.100.174]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-13fca63ce12sm20694924c88.5.2026.08.05.13.31.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Aug 2026 13:31:08 -0700 (PDT) From: Abdurrahman Hussain Date: Wed, 05 Aug 2026 13:31:00 -0700 Subject: [PATCH v6 01/10] of: fix out-of-bounds read in of_alias_scan() stem parser 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: <20260805-nh-of-alias-overlay-v6-1-74f21d440819@nexthop.ai> References: <20260805-nh-of-alias-overlay-v6-0-74f21d440819@nexthop.ai> In-Reply-To: <20260805-nh-of-alias-overlay-v6-0-74f21d440819@nexthop.ai> To: Rob Herring , Saravana Kannan , Frank Rowand , "David S. Miller" , Shawn Guo , Grant Likely 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=1785961866; l=936; i=abdurrahman@nexthop.ai; s=20260510; h=from:subject:message-id; bh=kN1eUXhzlmZ/uTG2/7ewWsiGSCgf0wXwrMYNI8HvUbw=; b=Pp9jRz3Hp/QzKiPlhgSbikASPf8D6CCitcDNJORdbru5ukCUr1beTjpvzpGh9tJkjqUnWxCM7 lvW9PlMxCy7Ad1lPD2/PA8u4kwiGKLmKkPxu/siajbwzuABGHWSB7tn X-Developer-Key: i=abdurrahman@nexthop.ai; a=ed25519; pk=omTm9cCAbO0ZhS32aKfJDKue0W3sQGpG9ub5eYHif8I= The stem parser tests isdigit(*(end - 1)) before checking end > start and so reads one byte before the property name when the name is empty or all digits. Check the bound first. Fixes: 611cad720148 ("dt: add of_alias_scan and of_alias_get_id") Cc: stable@vger.kernel.org Assisted-by: Claude:claude-fable-5 [Claude Code] Signed-off-by: Abdurrahman Hussain Reviewed-by: Geert Uytterhoeven --- drivers/of/base.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/of/base.c b/drivers/of/base.c index 6e7a42dedad3..477017ed6f49 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -1967,7 +1967,7 @@ void of_alias_scan(void * (*dt_alloc)(u64 size, u64 a= lign)) =20 /* walk the alias backwards to extract the id and work out * the 'stem' string */ - while (isdigit(*(end-1)) && end > start) + while (end > start && isdigit(*(end - 1))) end--; len =3D end - start; =20 --=20 2.54.0 From nobody Mon Aug 24 05:05:29 2026 Received: from mail-pg1-f171.google.com (mail-pg1-f171.google.com [209.85.215.171]) (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 9C6143D905F for ; Wed, 5 Aug 2026 20:31:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785961872; cv=none; b=XsCeYdPp376tRdGSKTYU90+mJ+GbOkUtYGgMeqqAdhoW8JWla0my27rpsm/Zv481zvupbEasR6pvYvFyGBKCJ/LgpyXNzewL5K8PK69Sc4/2KDcPhJxqZdXDj49HJGr5q7QAy35QcopMNV5FgfHMmVmnAUeUMmQhoXrgJxwJbpM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785961872; c=relaxed/simple; bh=atzN4T9hnhv1vj0XHXj7Uq6H4Tt7kjsN5kly1ikRCYs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=A6APya2I6ylRjxXqnp2g0DzSBb6y0neighmGEfzs5PdcdvS+/N1zb+9ClJwNbU8A6dLFj2XQ5brTGjFK5P+WCppa+bLuijxUkf6c1mfWMGLE6u0Uyw9RH3m6BpMc2OIua1pp2UkdVV9srAHzqzGINaytwLzEK59kgvDvUFOdfCw= 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=QB6Lm+s2; arc=none smtp.client-ip=209.85.215.171 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="QB6Lm+s2" Received: by mail-pg1-f171.google.com with SMTP id 41be03b00d2f7-cbe6295f05bso200808a12.1 for ; Wed, 05 Aug 2026 13:31:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nexthop.ai; s=google; t=1785961870; x=1786566670; 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=sO+CA6vi0PxBMnFwoi2jpRN5c1zZr3ozsf5hG18IO08=; b=QB6Lm+s2Wj5mt5GGugVq6uKwF4Ooe/PGdsfCEpRpR17QODjjCJN+AGhCXbmdJhB1U9 o0LQGEQrbeGgvSKwWBZSyk6WIxmmfEJWuHQ4UHGmzx5Mdi3guO3xIXlgYDJU5171nwLi nKqkfsQ+nJP7+8mXvYAtxxFJwbUjxondi6+P/8P1weCI/WZTgBriVPNE1z8ZXbXFG1et UJj/XHymv27P2zAyI0RNyI9PLiEfO6MQbgLUJNlf2mOaBf2XIV4V1FsE8LTcjITb2fX+ nHHO1Qoc5t/NdoNuvsZbJDpB6Btek/Yb7uo6EuEEqP/KBOpXVLgVlgImheh8vUkT54Ci KSdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785961870; x=1786566670; 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=sO+CA6vi0PxBMnFwoi2jpRN5c1zZr3ozsf5hG18IO08=; b=EVhNwXKYPVMxpAwl+J/VjjeGDAGLi3I+ZVerVVVVVdrO3a9XCTiZyWWKDXplfe+vJJ 0Y0p2Xr2Hbsh2TKcp66YqKhJBtWEknhsIBXJWDbUJ6A+UZcqddYFpP+2x1MD4BA3zke2 BjvNqfBfdipJ1OLo6XztK9tQYT25itTBVob45aWtUQ3CXPfdLfBdaXj8VurCG72eqCMt DnMyciwYcDLmDtGcPTCs6cd5ANG744/Vo4GU1Vv1ilTwys8iGJtb4kMNBFxf8qim/+XZ cpAhqXJyK8uDkrdyh1MlrgcX8IibDHdD1ZCyGg4BUtZAIt7euTnb0lEAgsNJ2Ys8L3fd 5aHA== X-Forwarded-Encrypted: i=1; AHgh+RrB6NvRXJHOUC0fADARJLo+AH3RqZCjbIx+GC0TNOd3KinbtfXR+Q7yF9GMm2ye2nuZF6whaNlCcttwIw8=@vger.kernel.org X-Gm-Message-State: AOJu0Yw2RxmWA3mbEikKHyiOnA5Gia6icRNcbuQv4BYFU2M2IH0j3ZLs p5nNVMVLTXMKTZgidDhwseO4C8Pc/UiIXmDTFLmDe2hQfPW3dso4+WZkKy32IOfFl/t5SxrhYQ2 WozNlkn8= X-Gm-Gg: AR+sD13zmwRLb+yXfinD0xmt7Awio+sPSjl1LlyJ01mCo0UGMKrTMd7LnP6KOGAWLP6 abu6qfbqZCdHZDY6+xrGyN3hbw4ZCIC22nrMLmaUKZN7B4285FmFx5ZzWEPWstLSebAiCcmulB4 steZDulF/8CNI85umLrr9oswKHGaeG98TPnETziObQB3B2CgP9PUd0xa0O0/ycw1k3lfjgEWYWY XS6ZcChs3oM0K0A00LKd5U6srf+Upn24OuLOTpCGNx8b4tc9bzpi1f4SqS6BYruK2XQpJFqFO1t BygeGYKp0Y8WlSFkeq9ZDlVSna9KPJMym6pjvlSUnFsV4rYgjArWjIESVcnoWuogbvUtylzWdPG gXmPmfuPC+0vbS5b93JCRqqdNp1GLtVVgVoBhAoDOkvkvcsqjfby7kPyxNWkmJzuH1l7rFFO9rj AJgZlZGYoe7Y36gQgw8GHUjS+a30HUFU4OLA/Kmgj1ehT/Chz3vljOVeV5+ckdTT0= X-Received: by 2002:a05:6a21:6f12:b0:3b2:8674:9830 with SMTP id adf61e73a8af0-3cb9c2338eamr2270842637.14.1785961869978; Wed, 05 Aug 2026 13:31:09 -0700 (PDT) Received: from [127.0.0.2] ([50.145.100.174]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-13fca63ce12sm20694924c88.5.2026.08.05.13.31.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Aug 2026 13:31:09 -0700 (PDT) From: Abdurrahman Hussain Date: Wed, 05 Aug 2026 13:31:01 -0700 Subject: [PATCH v6 02/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: <20260805-nh-of-alias-overlay-v6-2-74f21d440819@nexthop.ai> References: <20260805-nh-of-alias-overlay-v6-0-74f21d440819@nexthop.ai> In-Reply-To: <20260805-nh-of-alias-overlay-v6-0-74f21d440819@nexthop.ai> To: Rob Herring , Saravana Kannan , Frank Rowand , "David S. Miller" , Shawn Guo , Grant Likely 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=1785961866; l=3553; i=abdurrahman@nexthop.ai; s=20260510; h=from:subject:message-id; bh=atzN4T9hnhv1vj0XHXj7Uq6H4Tt7kjsN5kly1ikRCYs=; b=zpD8Eoss32GAayLU5QhEFB0qX2rrxPr2H/0RMnsYHY7t/MvSAss0T7vtrDSBcB+BJ3Mw+mlPk fo6mOyTCWfSC37fe/pKm5kxeKnPziqO1u3pNzrfVOk6vmpT+L0cH07H 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. devtree_lock covers only the pointer load, pairing it with a later patch in this series that clears of_aliases and drops its reference when the node is detached at runtime. 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. Assisted-by: Claude:claude-fable-5 [Claude Code] Signed-off-by: Abdurrahman Hussain --- drivers/of/base.c | 20 +++++++++++++++----- drivers/of/of_private.h | 8 ++++++++ 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/drivers/of/base.c b/drivers/of/base.c index 477017ed6f49..eca1f55eee87 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,24 @@ 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) + /* the load pairs with writers that retire the node */ + raw_spin_lock_irqsave(&devtree_lock, flags); + aliases =3D of_node_get(of_aliases); + raw_spin_unlock_irqrestore(&devtree_lock, flags); + 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 Mon Aug 24 05:05:29 2026 Received: from mail-pg1-f176.google.com (mail-pg1-f176.google.com [209.85.215.176]) (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 DAAA43DC4BD for ; Wed, 5 Aug 2026 20:31:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785961874; cv=none; b=rMlgTewvjvHwMA3aC0QbG/MeMdC2+4hZpBDH0aEmvi9LcKAnkShP6TEpC8CctDtHZWhRz+DIOIAz36cP+Z94ZTi1cIdi1N8SbvB1QkGZVJ5JPw6IHtAQTlg7XY7pN0fTERINFHkh/HpRQ1SF8oRPkH5/eQMguo3neUFpzW2Bcz0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785961874; c=relaxed/simple; bh=H/sIgBnzZelYpO3LHst4jrIIP3vYd1GLpgIYy6ZPAq4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=P9YpEbYJbadeIGaoTDbvx12F/x+irjEQEbXHThSfHK82Lru/r3ybYG71+tDAaOVRhczZ+9z1KfNsSpgrwwiaUxPXkYi2UD1CZ9I1bvzHXleyJ7YDLWNwhRH0Em92RAafDbn8aePneURFk1Q/jLgdRMfTJRMoIcQejBGJTLHj9OQ= 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=VHL7L8um; arc=none smtp.client-ip=209.85.215.176 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="VHL7L8um" Received: by mail-pg1-f176.google.com with SMTP id 41be03b00d2f7-caf45fc5202so1342533a12.1 for ; Wed, 05 Aug 2026 13:31:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nexthop.ai; s=google; t=1785961871; x=1786566671; 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=uTbGsyt7lxQwFqLnDMjhk922CpLKDo3zczkWY+WjjDI=; b=VHL7L8umLPpNalmYWe5NVGQPy//b2exOWTW5Ye+aM9HZOLN86zO7p7NbcQypeT+IR0 BHenfWPou5mFFARwiZ9nIEWniYT9sXGN3OhfZkQi/53nIkh1PGTfK3F1GVSCsUiccBnh 5dOtRh4bJmmQoYtsRUHUY6I0pfLZqOY75Q4Eot+/rQrGqy3T6/iqQTxJ4XV/nKTdRX/K ehrCzTpKCyTdVeK9uOed5gexoVMHufPVZwN4z/oC8pfn7My1z8F1wBM28A4G+w2PcjLd BS+6nQsi19aLsTPcnYndZLKjuU+4EEVP3a/Veee8pgjaioDnfjttUp55FL1D8jRz2S7o frug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785961871; x=1786566671; 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=uTbGsyt7lxQwFqLnDMjhk922CpLKDo3zczkWY+WjjDI=; b=INvp/2nZrirtgk/nBHgqW0ibODbZIPNf0BqJ6kvie/8EMeNY7IUlSPVMYNzIK5o7jK II8SsulrjtNgnwuNXvBvwefUB2eZGDyaKoU9TKr1FStz8wGNN+SbSF8mWFQ7YiXJWNqk c364AQtE0G/yffpZk7WuLlcZQ93RqUph+rX3Y2kwfOzwYejVPnlpyI0fV7wbw57xmg74 /yzp5Qo0BMiidOW1FYABL/AzG6Q1VekJjsXIJ65s9fZ4xO/34iDYgSSQ4Ql9ud/vxn6y JFpaNPUPi3W21A1L6joWLeQaxSEN1q1pY3zGryqB2RBER2ntkIV5GvXzQlFTkOflUZ5R qEVQ== X-Forwarded-Encrypted: i=1; AHgh+Ro1fY1Sy949ImOCgmIqzRSxxO2wc9l9GLVG8MNQamKRht7WgoG/eNybJtZrBLpMHBckZyFO/zSHmx9Z138=@vger.kernel.org X-Gm-Message-State: AOJu0YxlWPSY6Wj2+iHC0KBT3oYp7px3l+P9DxtR1XtrA3zSesyXlgQc YFdxy6aE8DqQMfwDwJjpgpvW67vrlk6wsOBQZ6uG99u2VJXgc7/BF7TNnp5GRM78mDI= X-Gm-Gg: AR+sD135vetQBuy1VLOxsMA+a1RPlZe8Y0t3B8F8exnjBIz2NEXO/DfgaiDPDn9Qm5y C8eLwbSn2uQvXTix0buvP3zxQwDQ7EKsaAxsc6ZBOFBQM9ZcNVZRwI8Sw/ulAET5pyLqkC8MIAg kcDkt4zWf/VEW9kPpnmit8NKszQhf5DWfYJYx6Fa09fd+0WxzNlpqf3c+vv1YhA2RDjxvQ8t9bu /HrzB82DvTE+G/5ZoLyb4vEcEZ+NXGKsNj1nQCh/hTv4T3hBP/p4W4Y4bOA4swYWcVQxZpftdZ8 HH5KgT7GDyM2PHdu7HcBVCjnHFzcShba6kTVEwnr23i98roXWYiU+22DNhqvChz4zvnIM/fBRVd bneUJU0B2n0AiImOcBN7r8WPadx29DsKsC399h1S8r1bNz8Q9c8Cqw1NMoNUHIlU29NQb1I5abg +tzczCZVb3jn/yk8S0fxYcpK5A48SrINYMHBZHN82dQMg97Ui5dDESuiS7AUiRCkU= X-Received: by 2002:a05:6a21:3a82:b0:3c4:2b8b:e88f with SMTP id adf61e73a8af0-3cb85df0a26mr11550975637.5.1785961871028; Wed, 05 Aug 2026 13:31:11 -0700 (PDT) Received: from [127.0.0.2] ([50.145.100.174]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-13fca63ce12sm20694924c88.5.2026.08.05.13.31.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Aug 2026 13:31:10 -0700 (PDT) From: Abdurrahman Hussain Date: Wed, 05 Aug 2026 13:31:02 -0700 Subject: [PATCH v6 03/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: <20260805-nh-of-alias-overlay-v6-3-74f21d440819@nexthop.ai> References: <20260805-nh-of-alias-overlay-v6-0-74f21d440819@nexthop.ai> In-Reply-To: <20260805-nh-of-alias-overlay-v6-0-74f21d440819@nexthop.ai> To: Rob Herring , Saravana Kannan , Frank Rowand , "David S. Miller" , Shawn Guo , Grant Likely 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=1785961866; l=11493; i=abdurrahman@nexthop.ai; s=20260510; h=from:subject:message-id; bh=H/sIgBnzZelYpO3LHst4jrIIP3vYd1GLpgIYy6ZPAq4=; b=DGUq27YeqG2iQqSEbr22owagDxA7sTT0DtzbFii7ilWGT8SgLe5LNbYEb9NWNpYYBKnXCfm8e BNZaiz4dRjjDxuUAdvlZ5B5f7IBPJVlbxvtHaf4Cwwx59zc0gD8e233 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 pointer updates happen under devtree_lock to pair with the reader in of_find_node_opts_by_path(). 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 | 210 +++++++++++++++++++++++++++++++++++++++-----= ---- drivers/of/device.c | 4 +- drivers/of/of_private.h | 14 ++++ 3 files changed, 186 insertions(+), 42 deletions(-) diff --git a/drivers/of/base.c b/drivers/of/base.c index eca1f55eee87..612e2cd31688 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -1925,6 +1925,170 @@ 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; + struct device_node *put =3D NULL; + unsigned long flags; + + /* 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: + /* of_aliases is read under devtree_lock by alias path lookup */ + raw_spin_lock_irqsave(&devtree_lock, flags); + if (!of_aliases) + of_aliases =3D of_node_get(rd->dn); + raw_spin_unlock_irqrestore(&devtree_lock, flags); + break; + case OF_RECONFIG_DETACH_NODE: + raw_spin_lock_irqsave(&devtree_lock, flags); + if (of_aliases =3D=3D rd->dn) { + of_aliases =3D NULL; + put =3D rd->dn; + } + raw_spin_unlock_irqrestore(&devtree_lock, flags); + if (put) { + of_aliases_forget_all(); + /* may free the node, so must sit outside devtree_lock */ + of_node_put(put); + } + 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 @@ -1960,42 +2124,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 /** @@ -2013,7 +2143,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; @@ -2023,7 +2153,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; } @@ -2041,7 +2171,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; @@ -2049,7 +2179,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 b3dc78f2fa3a..fa0cc8129ab0 100644 --- a/drivers/of/device.c +++ b/drivers/of/device.c @@ -237,7 +237,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, @@ -245,7 +245,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 Mon Aug 24 05:05:29 2026 Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) (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 9AA3342BEA2 for ; Wed, 5 Aug 2026 20:31:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785961876; cv=none; b=QAN741oUxtOQ14HLpVNS+OQwucd0lBL05gcyMS105wWGa3GR66Iwn28FbitbbRuE0v73IYRhE4D4DHtysFeqNMD7qd+QEXNscwk1yuSV+/ERJYVqoUqCvqx+j4LaVtPUMOKLokXqTlX5GX5w/pRMr8TSPDwvYt8TmIMGfCA0M+M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785961876; c=relaxed/simple; bh=i+iwVi9KMRy/SRzPz0dFMHY5QfWjU3ehExfRWdvyWCg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=VOJYI4OdeizkrBvWrTdgFx+DmXy28HfLYgLGHSULEd63MP6clj5qpFW1F4Z5TqdgC4dTNeOkXiCvme1BgbLVRjWYx7LiM3RmKeYanAKRiVud8wpFoyLKJSHv7Up9U3zIC2ehCt/PCq4l6OqOdUNkLeUrxgMw6BZAwHB2ZJHFPds= 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=ii3Zx1oN; arc=none smtp.client-ip=209.85.214.170 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="ii3Zx1oN" Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-2caed617615so20197485ad.3 for ; Wed, 05 Aug 2026 13:31:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nexthop.ai; s=google; t=1785961872; x=1786566672; 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=ii3Zx1oN94t7vrNzV4xeY0LoxSvde3wkIOxFY6YbtZTZ/X/NU5UQXXiBx2CCr/Fuim ttQkVaJ1Ijjf+HipVrEN7SsX4a+3tHiYd1z8vArU/DyehriYXaWL0FD+OAPXWYwHeeOv UipGZWOSSltzqRWha+G6lEq5mrne6DCXP+cwL4UaB3tV3Kk5W16cHVaPRtWwmI0wEPxn ugOwca+tJmnb6INYg/B+FIh0zdQHdM/+FDsk0xVCn0p+oClKSHfM6ksV0CyW1Xjg+lGf 13AKd/ovvWJg0XKN2djf/Th+wjZ1YUuOHKJbTu5oCeycDrbHt7HpU9Sq6OrvETJupgK8 yHbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785961872; x=1786566672; 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=ABBTCAg0EF6aRIFqePgBa62Ph2pN45xM3uVfY+GKWR/aFmWehUklznaa2SZbpS3gEx Z6hyhRvQRQ/OX07vaIbyi2H/zwowtEDy2bhJim4kqni3fP5cFledUzphfmQ0i7wRo/jc QBN+yx1O9PtVihNnU9TJ9YUEXJIMSzOrUcL7OVex9M8ZRsmo3nq38MDSag+86aE3umQO aABfXx/Ugmb8Pjq+M39UCXUE5EqNPVg+E7nVWT+ijVqW5d6h6YDFRHjk6ZaA4R+N5gxp Iq5sMUyz3j5dJ/fc6YtV6WqUXBuXVOCEc7cwB8xOwfWMbJsfvwiQRUd+QmIVz41JaKm1 pCiA== X-Forwarded-Encrypted: i=1; AHgh+Rp1mklmPDyOXZA0BJzWlFoIn1RGdsVr1D92IgedaSjoGb5Vu6DYN8UuuqUYNq/W7hLUxED4m4XirVP3BUo=@vger.kernel.org X-Gm-Message-State: AOJu0YxyaRuPDK78CMhAEKQsa7tzWz7OoLkT5WF/15Fx+WLFqA7Qz/xh T625UP16bIp/CdLjLrOILlT6HM+m6t3vzHUIZJ4I8TmLc0HXzff9k8UWvo4fzOHGrlU= X-Gm-Gg: AR+sD10f6wYkxHmludCH0VQzsKKnn9UuG8/M92OAiEoYQhukAo2qbVMtA7hqxV2DwJ8 bSQ/TlALjTsJ/Niugp4M7YidFUiPMcLwSjiNLm1RPscQSDE1Cpv1vn7KqX/bbPk2kqdIlSpDAuQ u0cZSa/qdfjIbNPh6VDoaWogF872FcWe/1zDmhB9HRWH6g5+y6QrgkZ7v8vriwe7yB8q2DPrzHs gbEXafdOIS3dUoQVixaMv/V9+jn1hMaOPrLX0cWOkWQsHzBAyta4c7yukaqg9obtg4nKkmaDNf6 OXeGl2+CR9IfLtmg3cKsyHWPgH0aOYkOlLPzsk4/isdE8mpY0k8XndnSlo8l2Uu4ivszxu34yh6 vwj/MJWusTW/vxRXKY5FZ4Xm5r7Fu+DAMRj9iIOVa9b/mi2GZA5j959XLhnuylJhqyZZ978ZE3c IEals7QfbeNRrKRcWUyJLHmk8cPbCqOXad/n9UWuZc67XynTEyOvrHYHzU6IGiGh4= X-Received: by 2002:a05:6300:4049:b0:3bf:a543:e7f5 with SMTP id adf61e73a8af0-3cb85e9920dmr11209730637.3.1785961871923; Wed, 05 Aug 2026 13:31:11 -0700 (PDT) Received: from [127.0.0.2] ([50.145.100.174]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-13fca63ce12sm20694924c88.5.2026.08.05.13.31.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Aug 2026 13:31:11 -0700 (PDT) From: Abdurrahman Hussain Date: Wed, 05 Aug 2026 13:31:03 -0700 Subject: [PATCH v6 04/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: <20260805-nh-of-alias-overlay-v6-4-74f21d440819@nexthop.ai> References: <20260805-nh-of-alias-overlay-v6-0-74f21d440819@nexthop.ai> In-Reply-To: <20260805-nh-of-alias-overlay-v6-0-74f21d440819@nexthop.ai> To: Rob Herring , Saravana Kannan , Frank Rowand , "David S. Miller" , Shawn Guo , Grant Likely 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=1785961866; l=3883; i=abdurrahman@nexthop.ai; s=20260510; h=from:subject:message-id; bh=i+iwVi9KMRy/SRzPz0dFMHY5QfWjU3ehExfRWdvyWCg=; b=lrB8lQimiqH02owqqjAaVe+5c+ax/rWTOmwpAjaTTGl4vLfVHC+4sR3boy1JNqFa/yVaf2HUX kJqubsnjFgrC6g2RC+9gG6esc2l/raGc767SipTRbQwVz4iGvCOMxo8 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 Mon Aug 24 05:05:29 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 AE9574071FF for ; Wed, 5 Aug 2026 20:31:13 +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=1785961882; cv=none; b=oidLuv//sCagmPWIhRWy1ZP8k6rcVrB1W2cxlu3kFATzPWwmgnV+7/g38kL201Pm1v5EHlg5xIaAjTE6dbvLU9/JUzS/exW9ac6AMLSpayRk9rP5oSUqHT00RW3Qh56wkYgRl8rEKU9YNkVLMK+fU2iD5POtysgrVV9wQwvTr+Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785961882; c=relaxed/simple; bh=y82td47R6V/tWGYU6bxKbZBUuC/UthUD3LtG/Zph//U=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Aj+bZpQOR1hFTDbAxV/xZ1+A+92lR3dd+Ho7DGoBzrBD7gJ1brWCjbzk1H1WFNU5klcc/wlHJMpjTm6spaneBU3E8DwXzAQFnOfmwKds9QDY1VjiSWZ+S/z9xE3CS+bMzTF92xdnrCORuCdnNVKebiGWMMYpuVc0FQ6bJxZSn24= 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=MiY1sIjS; 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="MiY1sIjS" Received: by mail-pj1-f52.google.com with SMTP id 98e67ed59e1d1-382ef647e20so1587538a91.1 for ; Wed, 05 Aug 2026 13:31:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nexthop.ai; s=google; t=1785961873; x=1786566673; 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=GC82QffMucP6sKMAwijB741bfjScziJk9di2u49dRhg=; b=MiY1sIjShNiBm0AM1BjvRKkv7k52JpQpdg8kvsrF0uRoxL6d4n4B6RY6QAlrvXUmiE vJ46axuqaMLO1X5f0KiuFyYZvAv7ec1M4SLNgHa1+oYbOQd+aYJE8F8KOOviDoeHAzgl Qv1ULJEm2PlEkjeRVGiKaI+p1Hcg8EGbvbwGXRuvaWd0wJtvTS/K4agTwaKaotdJVI0H aXoXQorSjejiTQKGrPcnxFJ4Q7g47WxJlSR2PyXAQv535jgO5hit2QSsw3OXXrFI74ol VbpjoB6C6IUNy2XkSfqJr7bZLmk7B220fO9bSuH3sEx72u9MLkCobwIuUBgk+8u5jKwI 3aTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785961873; x=1786566673; 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=GC82QffMucP6sKMAwijB741bfjScziJk9di2u49dRhg=; b=RkE2SFhWpetqUdaf4Ny7Hu8SpA7psd3gcAVzGKr3xWDDC+LpaJlNRoNowHn/UTpOsl T3mTTA+YaXH/20/tCKBGz+d2XNreSnVLjCga3pN9sVZvq1FYGTZG0wbbygjcy1olZGC4 jmhH3QmjvpiJiOdGLgSp3AhvrtwaXiGO56wEBLyoX33HvCa9LDgVmHwPe1m3t1qTIq8e MpcW7lvDSNbzPac/1xajpbnxMsMWduPIXPX6IRdn3C3cTbMd9v8MGXJYEZiKl8GqI7my 5VFmbcHYoA3W+DF1bxHjj+veHTDBPftfM8XkyA+hNvkId+9J9xU5YHuNGxjzFgoX70Uu KpEg== X-Forwarded-Encrypted: i=1; AHgh+RqLQZ2mEJDZY0QHmHTKKqPvBKBg1BWu/r/CjP2hH7kpkhGBKkqcgEmA9k6wpV2SQwzlF5h5PzdAujVjy80=@vger.kernel.org X-Gm-Message-State: AOJu0YzBJGI0DrNQuXTYzTngbiB/y180mAEKcWDiiVQS8zpIAbO0cx7G n9xAjooJEWpHC9A3pPZGS8zu+krtq+uYh4A7RyYihfgCM3uxO9PUA2IMiwbZafRPj68= X-Gm-Gg: AR+sD13dv45Y80MozBrDfqEsYFKdToIncVUyKgpGxJZKv1hMxeFDY056NltvJGVQYHB BnRpiL2j2KCqKY8ivjWg4PZyMX8rWVmKtlib3lIV36Z9IXTeB3jIHVlU3dN4rfphWsc31VIIaFF uIsUDNYw8sMXOHiQbENcIL4MygBkcANZpIv8irmrHoR3AXH0HlBpNvPBYO0T3krvx9hYSNKCGFn e5VlfSSOHC3mNJAZMUvfkx9ahyXfkkk7S83SZiF30ZNF02NYZBADF3gDa03+L2Dxi/oKq56HlNL 6lvhQcgjRpTASBujy5xqwdeFQw29Pc/bXYijUtBF3ufiGGD1wrfY1uzaPazUpqGVVIgxB3qDIWI XLZ1vucEyE4r9xm9fN6JF2urFmj46Tq+GEU/rL6zBIT+XvOCuuak2WSSyoJEgy5NVSTDLb8c6t5 MLFAbdY4cmpdCM/8tLznQFKSt/yf56Su1evByC8iCn75IFR50EirOjQPRxftGhMmM= X-Received: by 2002:a17:90b:4b81:b0:38e:7f1b:efa with SMTP id 98e67ed59e1d1-3903c582798mr8498748a91.11.1785961873006; Wed, 05 Aug 2026 13:31:13 -0700 (PDT) Received: from [127.0.0.2] ([50.145.100.174]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-13fca63ce12sm20694924c88.5.2026.08.05.13.31.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Aug 2026 13:31:12 -0700 (PDT) From: Abdurrahman Hussain Date: Wed, 05 Aug 2026 13:31:04 -0700 Subject: [PATCH v6 05/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: <20260805-nh-of-alias-overlay-v6-5-74f21d440819@nexthop.ai> References: <20260805-nh-of-alias-overlay-v6-0-74f21d440819@nexthop.ai> In-Reply-To: <20260805-nh-of-alias-overlay-v6-0-74f21d440819@nexthop.ai> To: Rob Herring , Saravana Kannan , Frank Rowand , "David S. Miller" , Shawn Guo , Grant Likely 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=1785961866; l=1617; i=abdurrahman@nexthop.ai; s=20260510; h=from:subject:message-id; bh=y82td47R6V/tWGYU6bxKbZBUuC/UthUD3LtG/Zph//U=; b=ZNFXgYfP48+jI+CiDhAPnYsZEKJ/OcRK5O2igRXNZHo/h9h1FxGIzyjjjeVrgNPp+GTo3tpLA 9ShZJF5B/X4CW3s+BcOV1NmfzEXsUFfJHyFxz/lCMOI80I/FrvtbNnT 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. 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 Mon Aug 24 05:05:29 2026 Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) (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 0F4DB42AFAD for ; Wed, 5 Aug 2026 20:31:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785961884; cv=none; b=exkC7rh0HItSkPVZJ95JsoATrM50Ar1hG4APAksS9ozb2oQNe7ygr8MObyGcz29dLNmg76bLpIITr3lWL1YT7H40n6UaTOhJc02XaC89P1vOa8xIPVt3Wn0CdeLjpQpPly4LStXUDavki3whcFERhFaDmHI2BtACV89btJoVzDs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785961884; c=relaxed/simple; bh=Or1MHs7BHU4RwEsjCS87/j+WE5saCqR41FA7BAZ9WfE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=BX8hspSUssBtPWSM5s6vpaV7dmQo/ViQ0r9rji+zzSxv1orS2HYyTUr8oMRQZVGl7A2W8rw7grDdCQvPSvKQ10Wu2AZQ/lZKPQdJpF0xyFw5cKDzGLycAeS3CHXsOemNgI+waxbzRlx3WagSesDmxQaXUwxFrwQcDGHiEphygrI= 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=M4zmHeO+; arc=none smtp.client-ip=209.85.214.180 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="M4zmHeO+" Received: by mail-pl1-f180.google.com with SMTP id d9443c01a7336-2cacf197759so21885955ad.2 for ; Wed, 05 Aug 2026 13:31:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nexthop.ai; s=google; t=1785961874; x=1786566674; 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=Vi1HjMdF63tIWmwZPIcgrh+hHmXSZEnMc+Ltimo0SR4=; b=M4zmHeO+lz0LxE+3Mgj9IrZthMTKMw3vnWABARi91BKVogswr2aB3RpFa0tK4aoBES fxhJBNswhgccI4TZ2MNJAaXWwF7dz+Cg0OXzKd2pYSqQJq4JTe5z+m4FV72lcaTYEGaj 72biZY02Xbr+4mqf9W62EKbZCHafKPQiKZ+1mBfCPebLA0T+9/anzWNelUNMTZe1X+NW E6QM3Wg7gmMDgd9VJ65SRIf83TFEqtHqUnfh+N77fIMff+eZdsH6HR8qra4h23zEviIs kC3RedC2I/hzIXwth32V2wrKnU7Gp0nxD8mVo8y/1+a73ZLjKScmTI4sDyppeyz1JUyH HJSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785961874; x=1786566674; 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=Vi1HjMdF63tIWmwZPIcgrh+hHmXSZEnMc+Ltimo0SR4=; b=k0D9ftToWQbAlviQBmiRa01W+yxC17epghP5hNVBYdTxqkuuljV3zkzrwiVyQIABMD 3IoQuA2x3E85739AC38Pn2Nc5TuOOpHUHuic2GwKNG+WdAmSW5OvAPi8ptnWywwqN8S4 Df/WrBRIlWzCqW/O+x1k6DK0ezhar5fr9eIkmMt5ic6mcplOHA6EO0vNTPIXcLeAvw/4 mLTX1J9WrdzfRE3Pkk/cUcBOH80Qd89dxwWAjrFBFnqvoXRkbSDUIyW1m3LQPsJlFJe+ Vb6yclACXybajUOCZAq/e1yGHgaE083E2EaMic/dD+B/on70LTsEs5BZ9h9r2hCmPMHd NWMg== X-Forwarded-Encrypted: i=1; AHgh+Rol1mdoEfp/9A1em6qh/0MtwFkCimvGNdEj7f/aAa7QsbZnLx6+B+yK4UOCBR3Es0FN/HUlwGWyWlhChyo=@vger.kernel.org X-Gm-Message-State: AOJu0YyS/ANvxckbMp7QhCxIZ4uRG/tX/LZP34I0ONwkU6fev9amhTQo 2rrHr2cQBEuDgEs86WgwydiB+AbrCvwQJqdROnSrunnAcuZrxX1deGMUX8E1qSpBJlM= X-Gm-Gg: AR+sD101qAE9AG2AVOe21AT/tb+oTCluNjblFX/NeeIX4x/2Hsbiy5cHe2/A5YzH5Zx W4VxkjmgYU9o0axWoxiyXAG4XQ1QIMd8/48GgSiFsBcfSUB8PxyQO/yxUdY4scj2NQP4a8mAJRt 1twCfOw6plIJa6cbG9sDXUb+mjyeJHDZST13C77txrqRWV0kwwJ0Zala97bhkAhC7fl10Bhlp5b +u4AxlhwIZoapt/XLn/fnk5UQE0m7GIKoIbE6yhQR1OpGEZLN3FJg9wa+E7ROrINmHMmU4pH55h ph8krME2lKPReY65eQn4m0i51DC6hCmTHKm9eyxT7/yOdlsHLSDdeaI9F0NGAvPB0+LPjh58+go 8XVsiiRgfsJ7tMgGosOTiTr6evyxret15Aa2h2KIaO2dIVtN8G6GFh8jxJjOOCLQ0Iyir8HU1PO 5z4LhYDS6TFF4LV03o+0q7Y9eXf2JNJGO14PJrpD+oEXinWc5I1P1OAW/cPPISEr7uy5TlefUhR g== X-Received: by 2002:a05:6a20:734b:b0:3b2:8685:1473 with SMTP id adf61e73a8af0-3cb85dcb2efmr10868548637.7.1785961874000; Wed, 05 Aug 2026 13:31:14 -0700 (PDT) Received: from [127.0.0.2] ([50.145.100.174]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-13fca63ce12sm20694924c88.5.2026.08.05.13.31.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Aug 2026 13:31:13 -0700 (PDT) From: Abdurrahman Hussain Date: Wed, 05 Aug 2026 13:31:05 -0700 Subject: [PATCH v6 06/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: <20260805-nh-of-alias-overlay-v6-6-74f21d440819@nexthop.ai> References: <20260805-nh-of-alias-overlay-v6-0-74f21d440819@nexthop.ai> In-Reply-To: <20260805-nh-of-alias-overlay-v6-0-74f21d440819@nexthop.ai> To: Rob Herring , Saravana Kannan , Frank Rowand , "David S. Miller" , Shawn Guo , Grant Likely Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Abdurrahman Hussain , stable@vger.kernel.org, Geert Uytterhoeven X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1785961866; l=1466; i=abdurrahman@nexthop.ai; s=20260510; h=from:subject:message-id; bh=Or1MHs7BHU4RwEsjCS87/j+WE5saCqR41FA7BAZ9WfE=; b=BI+hMWMEelWji4+07CG+Kl23bVoo3g1r9UXMuhI9QOPfBNP/orkMQKg0Kd65fLCicQGYx2EmA h9Lj5k6JHncBCgNMrN7tGo2IbTiIfRvHkXU+gtcNdIqWVZacDuB8Nif 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] Signed-off-by: Abdurrahman Hussain Reviewed-by: Geert Uytterhoeven --- 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 Mon Aug 24 05:05:29 2026 Received: from mail-pj1-f45.google.com (mail-pj1-f45.google.com [209.85.216.45]) (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 1ACC4425887 for ; Wed, 5 Aug 2026 20:31:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785961882; cv=none; b=IcTU5itESN/hsopf14klJq9jOuk732s8dza5le9ruScvZcZD/rfl3p8HHqsfIprAy6vR5lnhMlyfrdauIr00qWQccadzhjWLUajpghihh++97ERnVsHKoQI47wsZ/YD5OUkbUONqWuE9XRjEDmOtTPbudBEr36bg1Mnb+vzIA4I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785961882; c=relaxed/simple; bh=s8bjlOSsr5bX0LzXLOFz9o7IoNCJxpjSj7XFRKaOCXM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Vd70ui5J3hioIcRtvK4Yf2HxsX5Q2FEWNOqGMGLDuMDGndf0IGgoQD+5RiEJqvnoZm5qdILAAuhIjXsfetdTb/5K3HpI6EFpNxOsfqHSXRXu0CEEGU62y26piT7353Hg4hQpZiTBes3vGuznNJOGOnZu00ASjddgzmJq2yUUMuM= 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=IiswPitx; arc=none smtp.client-ip=209.85.216.45 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="IiswPitx" Received: by mail-pj1-f45.google.com with SMTP id 98e67ed59e1d1-38f0f132f56so215492a91.0 for ; Wed, 05 Aug 2026 13:31:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nexthop.ai; s=google; t=1785961875; x=1786566675; 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=d9DwRuIawSSg67T12t5FthYSXOeUaCNo0SS15ivwagg=; b=IiswPitxu4AnNQCosuvUK1KVqnrvCuOnscd/448kJmWH9Q8X5+GsZ7Eg+J7TdKNhYE k21Q50WtA2aooSPPamwZcSFKXaXeqKgahjZPCoB4aJluw/Z4ky4XIcYcCejhK2euMlBd H7n2L8iYvTHJme5o66n+xeJucAAUcVyvCl93lUKtRkTSEhtxoSugfiiXAUK4Z9T8xCWi Ft/OfBtLCk6olPj7wrHH8Qwtg8cLy9vnAtMSU0g7HwPiPKacVSVUgrf/3vyx78RTauCB qnKzp7NW6oKd82jkZvhZykjWUGxkxnolnr1wnaP+z5FuJ8rsoSyBkBs2rvw8Ip6rK+ed FHyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785961875; x=1786566675; 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=d9DwRuIawSSg67T12t5FthYSXOeUaCNo0SS15ivwagg=; b=e9BUWXvKDwbrCR1Xa0Q/l/aj/s2tDkzjKZ0DFiAdzvS3R3DE/hFqLjF8FSawTvEkO2 QEzx+a5BLbgtGv15w3aTzEtYQjSEo3qIOiUamIxCp7msMLsLG74D/eQYlxmV1zfn4rCz F2gPyxmJ3AfbU2pzj9si4chazdYlgGnZsmheyNR4QVjlnFwMvSg3BqkgnaS9eAvJFT9T UHnojkpmC4LwxezzitSNDOSybUOD4TkfeO9QSeYRbCIBYjMS0DEzWyc/Z6FxCDWvrlJf z9RZ6Zp4C1UU+yVTQNKIJ0rqmWAu4DDxdbQC8xvb8Ffgj5zliDLCAO3KTNwwzTFSqPv5 lH9w== X-Forwarded-Encrypted: i=1; AHgh+RrDhLaCxYlnKZkzaOwZVmCS3PZJKcjFMFmNHevJf6M9F1Cj5QO4cnXK3LDy1oUrRjzNpQjoRuvnInfEa7c=@vger.kernel.org X-Gm-Message-State: AOJu0Yw3/FbF38oMOb5CL89WNqG7KE0CgzArJxn6Cn4u/XSis89TvpaL sXUVm9yDZT66jZW0El5wbh6sWcP2oied0MhsiIJF+ikMnDiSqd3WhcDHgVL3QiS+mh8= X-Gm-Gg: AR+sD12F5LbjoQu4MFHkqrPLHF9nvPxsIoSBijYfh7W2lms5sA6QcHJPiohk65umr2P AYBqwoQNbURZ6vghH3hNyvEfWBgRouPRPE9ZCqIKJ/743NjamTHNAhRtQfUAw7eKJgWVh5028Nm 7yYG9f0FXrfKKmxUooT4cA2Uxo8a/sbOoP4v8FQjnDI86jhsmVUKVySPPhTG3+vogO3YG4RzGIt yGLcEQ8EC/1o2J/3e4TLtO9gUJOAUEKxtrFcpgaGSCXkKS9q7I73Y4x88MHySfJlj7jJTRrlDAY k2TRTrOsFptuznmR0etzzTVgqqco7BWzNs8IboN8XrU9NNMfQT28lxgZL3Ys0ILul6hILkWIfHk NO9YqwDDAieS9HOLeEyMHhjBc//VopFAoE3a6fVVhs/sRpKEvbqEvZnevtcirwYoWYtzG9fttNX R28gDF9xhN3j3yuwgO4newkIVhHzTS1CGDqmx4eN0QePKLZx/xN2vl6Ly6ENT3+iA= X-Received: by 2002:a17:90b:1348:b0:381:10a3:8b10 with SMTP id 98e67ed59e1d1-39083b021a7mr892628a91.14.1785961875358; Wed, 05 Aug 2026 13:31:15 -0700 (PDT) Received: from [127.0.0.2] ([50.145.100.174]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-13fca63ce12sm20694924c88.5.2026.08.05.13.31.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Aug 2026 13:31:14 -0700 (PDT) From: Abdurrahman Hussain Date: Wed, 05 Aug 2026 13:31:06 -0700 Subject: [PATCH v6 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: <20260805-nh-of-alias-overlay-v6-7-74f21d440819@nexthop.ai> References: <20260805-nh-of-alias-overlay-v6-0-74f21d440819@nexthop.ai> In-Reply-To: <20260805-nh-of-alias-overlay-v6-0-74f21d440819@nexthop.ai> To: Rob Herring , Saravana Kannan , Frank Rowand , "David S. Miller" , Shawn Guo , Grant Likely 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=1785961866; l=1298; i=abdurrahman@nexthop.ai; s=20260510; h=from:subject:message-id; bh=s8bjlOSsr5bX0LzXLOFz9o7IoNCJxpjSj7XFRKaOCXM=; b=N61SjICd3qHdvPjNHn6WNFO12IA0zWpXffAUgUFETIXHwY3zRLEXCf44j1EWEoyvpYKmlXoFK G5Uk2WRzCO0DE8FBvmU/DESrCY+HZ38xmzdxb2MVTQLOLpioLG/bLYk 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 9b9f198a1d70..89a9fe6d6e78 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 Mon Aug 24 05:05:29 2026 Received: from mail-pj1-f46.google.com (mail-pj1-f46.google.com [209.85.216.46]) (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 28B942E737E for ; Wed, 5 Aug 2026 20:31:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785961884; cv=none; b=oB8zoRF7fcaCcQjw7fMgtej7vQJkRquua6GZ+sN620/+Ccjy9g0vlKBF11Uxz3+hCoAYDCCZa1DIIKA0/TH4WV5lfgi4qbGYFwH4RNBM5bCAoXsCZ9R5IADHLHBUvor7j9Vv2kIvF2uxVszUpzrZYz7eZ964lV71Lviep0c8DlQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785961884; c=relaxed/simple; bh=uf2DvX8OK9pwtfhfHWyR6w2v1HFCYdPTaTaeKyV/B2o=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=MZ/CbsP/pAXZMsUud5IwRocbPJlnLfTU4TqLKNOR0Xu7qi0I4WrJ8by5Y/Hh5a3J9pGkrfhGMAYd8ulodoKUC6JgcIMCcjMoQs24vs9QHNCukb2WZQk1KVnLA80fuj6U0i2NewJGsOyyBNxI8LfKB6d4+V/56K2bkdMqlmhf894= 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=XvD/114u; arc=none smtp.client-ip=209.85.216.46 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="XvD/114u" Received: by mail-pj1-f46.google.com with SMTP id 98e67ed59e1d1-38f620399a0so1312202a91.2 for ; Wed, 05 Aug 2026 13:31:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nexthop.ai; s=google; t=1785961876; x=1786566676; 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=eWf3onSOOHHmu4G6uaS3lf5o7e8XAcC0VzFCmK/OsDs=; b=XvD/114usRRHYvUGxyLsXxOxUidqUhiD/YlJ095XrTmSVaOyDZOrgFmL+hL1qpheHM NWqPNRxM5q2a/2CEMIjlZzTQX4wgDxUcAU1PkHni29cWAVVuB+w9yKQCAwIRaYoFA51z Prn0SJ38I11tct4D0/Plds03kAdHbWt+dfkj+iBVmpdoJs2NMXZutT3RFhNJyGlQZSDu RY4uoeXSGxAyf5KQ0KXudMiq9iFPOMhKdUeAjlZwHOjGV6uoFQ/6AjdWZePtHajw9Iae pJDKwzirQonL51OxRR2gNGFZK4IONC0dJVWPB6XlN543+uQZ6iZz43VN9kXgjsdlsR1e SNQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785961876; x=1786566676; 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=eWf3onSOOHHmu4G6uaS3lf5o7e8XAcC0VzFCmK/OsDs=; b=Hp9Y/BYC083RCxU2AqdudZzy6cdtREWzYtYGxLpGAZjmfN3pbMrmVQmNOv1zldI42K tQAGbj5rVpNOqsSS0d6P3LXCfPfSyqE1MCEOBbrbVFXxSyLVeLhM2u4Pkz6CeYW4C/yy 9sZ09ktBKYHWzX9uYc50l81tvWg3+5nnCu/ZV3p1CXzkUhd1S8w3XoOngHZPgcV9f3Ik ZUC6MXZnhPOREcG5pZepfYvA1BdC4FDYc2w0OTyo3oQqpp9OI48UZ1dxFPMlg0ckhYpr TAHiSyF4FKFq2KgdavY260MXA/mVlEY1bBH2LtCsOUg2IgsPkfOyeK+r2KaiQWdnVASa SQ/w== X-Forwarded-Encrypted: i=1; AHgh+Rp4gegJWGAlkVsLNRx3fG3BbEzUxAYnz7yKfLpag6sosdoZ5Lbe3k9RPMEQv0LXXy2b0EHNSPMI6DNS4kY=@vger.kernel.org X-Gm-Message-State: AOJu0YxyRiY8Pmhkr55qkr3Yubny/bhi8HGS01ptiGzxvkvukCFc4NTD 4Fmihqc065aUhlUzCJWcWFJlqWn3Qi5CIps81YOT3m3AD3I7Jh4fTIXNZxqqhGLQu6xMCzDoGEx VujZZ2pU= X-Gm-Gg: AR+sD116bjRfJPQBrpbyiHOa3GxeSHkpRT2gAjVYGF+//c3cf4zVePRhJ9hHxtSTuJN 9PL94WfWIo3QAzRiAsqqSunthgkB0rVuatj02TLOEe44xp+VzYrOxkTQ2FTlkL/pTzDymmyFchU CfEILFTtPlgrNGP5sS0eO68Eoaen8PShHhgf7Zlb3ypEi517WnZJ9Xs4U4reo2Esqxms44DGrXQ rUX6fSh2OVFY0diEOT89MmmPHXROXwzb9ZyhHDErtXc4yi+iaOxjUchTeMAXWHNPd3cQqgHQHQ/ 3QFxQbkhkG6DBWIZTrf3GERsC4z3b2OEIypmOsHRf4mOUE860hZ44bY0/4tOZ7chGxSmk/Mlbne xZNGBU1IZ82YU0BFWbVpeMJN9XcogAS+xUBdO7Y5RyGMmBOdTF1ZmqCMJFoqa2PRV44/nixs8XG hgN7L2r1w1MOTmcTmJxzcLm7nxE90cAzo37pvY1t/q7L4qqjKDoRqMyK4Y/k/MW6xjF6pPucJwo A== X-Received: by 2002:a17:90b:4f91:b0:37c:6910:5758 with SMTP id 98e67ed59e1d1-3903c542f55mr8214659a91.1.1785961876471; Wed, 05 Aug 2026 13:31:16 -0700 (PDT) Received: from [127.0.0.2] ([50.145.100.174]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-13fca63ce12sm20694924c88.5.2026.08.05.13.31.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Aug 2026 13:31:15 -0700 (PDT) From: Abdurrahman Hussain Date: Wed, 05 Aug 2026 13:31:07 -0700 Subject: [PATCH v6 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: <20260805-nh-of-alias-overlay-v6-8-74f21d440819@nexthop.ai> References: <20260805-nh-of-alias-overlay-v6-0-74f21d440819@nexthop.ai> In-Reply-To: <20260805-nh-of-alias-overlay-v6-0-74f21d440819@nexthop.ai> To: Rob Herring , Saravana Kannan , Frank Rowand , "David S. Miller" , Shawn Guo , Grant Likely 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=1785961866; l=4363; i=abdurrahman@nexthop.ai; s=20260510; h=from:subject:message-id; bh=uf2DvX8OK9pwtfhfHWyR6w2v1HFCYdPTaTaeKyV/B2o=; b=mBtIs2KFqvLl/gNEMLp20JSf5Fka0sEnUisSG3iwGSqKilHA2ZZWaJRDwaGo95zb2WPasg0yh pXFctQfIhN+ByR2w46YExvTohykYxl11MBC1587kfd9zzowiiE79EmU 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 89a9fe6d6e78..99cea094943d 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 Mon Aug 24 05:05:30 2026 Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) (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 3B8433E7BAD for ; Wed, 5 Aug 2026 20:31:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785961885; cv=none; b=CNqbU+gE4jLslQQx3+dQ2u7F00378IVXP4mEgBQLcA2sTWBB/QchxNv1OGmh2SOtQ5DCmV6VHWzF6CFHhw2oQDL8DNE7qXKrdo3KjuhKWqpTbttgsKlIhZmrCzEh9qwLZBvqfgSPtv3Tmh+D0cQQBAPSy9DGgLpeG0cJ48ZB8Q0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785961885; c=relaxed/simple; bh=N4nU42Pb17VPUomW04w1Rzq03lsv7rB2sUgDtnVs1xc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=hSCqVGvHtbwTV1D38f6RirLIGEYBeDwjKdKpeycXXqlEzHsOUN3aN3WZjysV3oQWA2S9M8GvKQPKnLeIRxDsoUrAeJKA3+ZFNSV6tZytme5iWHLq9FVqSOwHpl0tIo8QjVIivnGtr8HnwsmnCpx1MK82w21WDHKSzJRihiFRHkQ= 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=QeqL5673; arc=none smtp.client-ip=209.85.214.170 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="QeqL5673" Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-2cacf197759so21886735ad.2 for ; Wed, 05 Aug 2026 13:31:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nexthop.ai; s=google; t=1785961877; x=1786566677; 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=atpMixkx02Fo6agGmHIm2m7VVWrZXhm9tAKhq+tkC10=; b=QeqL5673h9E8ns/YCj1b0XFmgi7n5gFVr2EA2ldv3BmN+QGxCn6P/05b15R6V9W7vt G8lH/KtE0GteQWfdrBuCHWwETphFp4qFe/wiB3Bw56gIJ68WKgI6Ux5tyLrmiH0TUEyN TNMz+zI3/NKVfUJX9l2apzHPyrEmRpCQL2I24VKtwZCgmYYBqKYvyBXBSkq5TS8J64Mi zktnPiQ46tkvHKM7fNrm8HVYCd+ST84ynFH30Qaxw4f/7awvxunvtNnQwLlsPZrv1PXZ Dn5FFE6hBEZ/4t/0T4Va3w+KF8VK6kauDzR4u5E+KwDVY0bpRnUt3GWuIrfCYmOXIxP5 yL0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785961877; x=1786566677; 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=atpMixkx02Fo6agGmHIm2m7VVWrZXhm9tAKhq+tkC10=; b=eadAhY9xmjnnUxBz8ZL4rZPXeZtcRUaEw4MXXzHMFuQhfAm4Zuoa+JZ+sZtzP3fe1R MaY73JzHJw7/JYrDZW6Pq/oCTlwwGXljPgTkOlkkiT2CUBPjVkDbIPALw13ezTva8RS5 8xpq+yTosSH4Izp3FA5tL88toJb+RibN5jGa1bADYTpX1dxtO9kj9m0OVhv53Qvi0VO2 uq4XZV41JbTHLN06fIh2tnQ8NhmfJnMHwkX8H8xRvX4ea7OlBnie7wSI5hJLurT4wqMe JLv8GXbIN8c8d+5vhcVZPjoyzDP1wD159WD+yNZOWB00VZjbYZO3YnufmI1P88hoUS7r gAew== X-Forwarded-Encrypted: i=1; AHgh+Rq0iy6dUL/2xl8QwA9oD91Xqdib6A1vk9Yiye9mdBHDxKJZbh9aOT2xEc4ovgFP21PQVVzF0aTVaOvi6DI=@vger.kernel.org X-Gm-Message-State: AOJu0Yy/wKg0rUVQMHpKwgDooJgGpFrF5NBRIcjIOxAVKwQVybCOR846 IRGZe1ToRSKKKqbJZPqm4VNg6AQkJ7ECVSmChkVy7dMDDkAnHSLi/pyWtJKgXU8X7zA= X-Gm-Gg: AR+sD10mzmzTzFhcaYnvbLrTegQsZBQpug5+X8pMDkuZjBEvbj4D7FkDNOkueMAs3SL yBd9R1VuxJ92NL8fdRKYyOm/MHmrPmS0JKfs+EDljKDrOoqwKKHm2nQyfL18WE3nPaQdAy1lLE5 nxsqIP358JCIMdKf2MmpK9Oj+HYT3d6eDocBlMvbNJteHQOBsQcn5qkC1lRq8KnzOLE6pjzALIW LMHNq6b7B8NsxKc/I+uNTIThuk3muSYg/DANvYXkkLVC7Urlus8bmSbS/S3adhG9hlmNZ9gmkg9 bNcXpoWKUdINxoHYor/Z53VuJcOQzI7z6fdDLBJpALxxWdBbyW6KvzMlFXTPqboOudWgip4G/6w 53Y/I2U2PQ8kw3rRNquRK9gQf8QEg0aHKVSGf3SWduepDj1xGM/eMIvZY6l353oMez5LiXsIOZb aMw5exNafxlJlcDrMSb0JEhYIaZOa0jdXLPWnmvSPNX5FvUToJqLJO/882/qDeCkk= X-Received: by 2002:a05:6a21:6b85:b0:3bf:b1d3:393e with SMTP id adf61e73a8af0-3cb85dd6595mr11360152637.2.1785961877474; Wed, 05 Aug 2026 13:31:17 -0700 (PDT) Received: from [127.0.0.2] ([50.145.100.174]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-13fca63ce12sm20694924c88.5.2026.08.05.13.31.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Aug 2026 13:31:16 -0700 (PDT) From: Abdurrahman Hussain Date: Wed, 05 Aug 2026 13:31:08 -0700 Subject: [PATCH v6 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: <20260805-nh-of-alias-overlay-v6-9-74f21d440819@nexthop.ai> References: <20260805-nh-of-alias-overlay-v6-0-74f21d440819@nexthop.ai> In-Reply-To: <20260805-nh-of-alias-overlay-v6-0-74f21d440819@nexthop.ai> To: Rob Herring , Saravana Kannan , Frank Rowand , "David S. Miller" , Shawn Guo , Grant Likely 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=1785961866; l=2368; i=abdurrahman@nexthop.ai; s=20260510; h=from:subject:message-id; bh=N4nU42Pb17VPUomW04w1Rzq03lsv7rB2sUgDtnVs1xc=; b=6m7SFizqpHx5NGNWUhN2UDSksc2Afl0X6+xiyT2aV838zny8A4YN9MXD+M+wnoOjD+RgDtBPj Ta++AKO7DAWDzAoWMK6dVY2rIYWWoPlQ57SpcjS8veadcCf1ifDJpMq 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 99cea094943d..d74e2a3d6920 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 Mon Aug 24 05:05:30 2026 Received: from mail-pj1-f54.google.com (mail-pj1-f54.google.com [209.85.216.54]) (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 388F7427FA6 for ; Wed, 5 Aug 2026 20:31:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785961886; cv=none; b=Tc6MWOrLmb7zc+0GZ9b5lEWlfdIpDdSGpHyXicKSHtpMhl/sntks2wfm9ljDYZhkhggl6DTQKf+ObrJSpRTtgbt4OsVnwxN/zdCgAIgbly4o0cz8vUURPB4uec1bu0gwSax6zXyUscIrdCnENZZ1WRGu608N4YRxpqsQYgFehMU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785961886; c=relaxed/simple; bh=rtMHX9hWMpcieCzh+lEL0bv+hah6KKo01VRR5TnIRxg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=UFdzqY7pX5dLr5eESTPS0l4fr5vdKWusJ6B6YS5Cpu0YJ4k55D23eG8Sp3lT6wyv2uyATolIevf+VAeSUy1HSKHOj8KyEcLaiYKgivAP7QYv5h+b6b2e5I1qIUfBpI+yfsAehYlFaXTnpwg0bvBy8ZMu9y5OazlLJwMXJi5nKMg= 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=YFiI3oA+; arc=none smtp.client-ip=209.85.216.54 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="YFiI3oA+" Received: by mail-pj1-f54.google.com with SMTP id 98e67ed59e1d1-38e42560ebcso1385425a91.1 for ; Wed, 05 Aug 2026 13:31:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nexthop.ai; s=google; t=1785961878; x=1786566678; 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=YFiI3oA+8sXT+x889ggk/nfqTQO3BwhFAUWm2rDTLzU17VhOXh3pJZcUHtq7s6peAb z+jGe735owX1fp0Op2IdGe+rNjAb8DNJarW7amY1NSNJFDPSQ3XL6zVHD8YspeIBOmuQ pIJh10SNIs4cNTZTAf5AZ8x24hQVWxOpirbS1sKbe3VyxKqSBdfbH2Nf+4uPr3NvUuJG Ps4tB/lEjc3DyDJoUliiRDKqhcu/8Ih1QSctPM0O20qJE1xdKwBL4F/LBIaUAK3Bf9sM 8cXRCprWSWcXkcY7UWHbiCPwYzyw1GT7e6IqpAnPXvZWhhui6tuZMfD1QzjzM3Qvgyp/ 9KQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785961878; x=1786566678; 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=YisxsYw/sRU4VHXXtXOeQyxnrj9qPfjETNz6v4jaNuU/nKwd2Owasx5Dp0vdaurQGc cKK5M4VNEeuhgHoragEn7IE7rVYlvm90s0QQxt2KiY3WHjyyMUtKPr89C/1pKZJ1mfEN X+XUayWw8yz9WuT6yNAXdVUqGaQCXPgBfMAxW2+B9C00AP5pLRSmg00tDrMAVGSRM8Yz DPIb/UEn2X37ytYdy66ZTZ6K7RSgQUgU0Fz96seOLb0B/WRnL4ukulxRQTpitMLUSQZi spZvQwmM8qe6Ufz626JJIQ/v6cXIXjr5gpkjQFf+kHbK4agZ1leiVglM260jp0Y97cuX +A9w== X-Forwarded-Encrypted: i=1; AHgh+Rqpw7bSxojCbBUvOSUV4cXYVjn37S8lpVRCqtRLKlJfFZXEjX9jVd/TNcOfJrDJOc0g+OVRzGEsKRQPni0=@vger.kernel.org X-Gm-Message-State: AOJu0YyjzCk9cfpWrcB7S6WvqEU/o/+n+fdGYxrPAWCHxBIljutLoviX 5tNcmbnbKakOdUeeNevq44dPqP2QlfVki+/3sO/U0Qg+zEGUmi8zYvOwjKHxtgHtT6w= X-Gm-Gg: AR+sD13m8JMszC3ahWPEqlIkZW8hk7UelXLhlXA5yL4QmReXvH91eZOxXUBJgFyhPIk BXCQWhJyUvdI3Q77E4Qglog17scVkIkdsaqqQf7JwDcO/Wrcg1ok3lGRBWO01+jC1hAmscZY0qG jipPs9etTgPOhRQ5MPeoY2mDryMlfPUq2VbSaP01Tglrysvn4H7erkEFfUttXWpVNcHIkhMypdd OUo8WGU93FWenERYKz2FG/uZ8KTbJ4KEf1V5NII65K8ZYjaR5ZTTL/8BCqDSuIfkaJgt9g9THSE 7LVZA3pvLV3vD9ZoVQbCPJYtPaPA2Fl6XssYarIpnczierEXf6EW1TVfAkmMT100tCn7ZRtdCO8 BwMrH7XJOdPT1C/ZmwROF7QixBRKaLyTrHmG5PhN6NIMREgyiRN85+UpNIA2iLsVlqFG3n9hEqo 3K7+1ycZ1p3VXIXt8rjqdW0D58j4wIcTXeL/3rdUTUtLSfYdMmSjcctsW+Iui8Jhg= X-Received: by 2002:a17:90b:524c:b0:38e:5ac1:9517 with SMTP id 98e67ed59e1d1-3903c54b386mr9194151a91.3.1785961878428; Wed, 05 Aug 2026 13:31:18 -0700 (PDT) Received: from [127.0.0.2] ([50.145.100.174]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-13fca63ce12sm20694924c88.5.2026.08.05.13.31.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Aug 2026 13:31:17 -0700 (PDT) From: Abdurrahman Hussain Date: Wed, 05 Aug 2026 13:31:09 -0700 Subject: [PATCH v6 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: <20260805-nh-of-alias-overlay-v6-10-74f21d440819@nexthop.ai> References: <20260805-nh-of-alias-overlay-v6-0-74f21d440819@nexthop.ai> In-Reply-To: <20260805-nh-of-alias-overlay-v6-0-74f21d440819@nexthop.ai> To: Rob Herring , Saravana Kannan , Frank Rowand , "David S. Miller" , Shawn Guo , Grant Likely 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=1785961866; l=6079; i=abdurrahman@nexthop.ai; s=20260510; h=from:subject:message-id; bh=rtMHX9hWMpcieCzh+lEL0bv+hah6KKo01VRR5TnIRxg=; b=J2vflF8bV+KdsHqFUV1I2/2U7Yt/jQkPRdqmqJq3xyoTUJmt4hQhaw+UC2WaGkN5+JVA4TRfo Y11CmgSdvapAHSF4hjOwzK59Dm+BSkck3DC1WYI1PUAoYaGHuTjIPFg 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 &