All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Hongmei Xu" <hongmei.xu@oss.qualcomm.com>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v5 5/5] arm64: dts: qcom: Add eFuse nvmem cells for Ethernet MAC addresses
Date: Fri, 04 Dec 2026 06:43:08 +0000	[thread overview]
Message-ID: <sashiko-outbox-249242@kernel.org> (raw)
In-Reply-To: <20261204-nvmem-byte-mask-for-split-macaddr-v5-5-13c12a99383f@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 5 potential
issues to consider:
- [High] nvmem: layouts: UAF of devm priv in qcom_eth_mac_post_process()
- [Medium] arm64: dts: qcom: dtbs_check failure for qcom,efuse-eth-mac
  layout
- [Medium] arm64: dts: qcom: standalone 8-byte QFPROM slice breaks DT
  modeling
- [Medium] nvmem: qcom-eth-mac: premature
  fw_devlink_purge_absent_suppliers() drops links
- [Low] arm64: dts: qcom: duplicate @0 unit-address on eth0-mac and
  eth1-mac
--

commit c44ef6ebd0ca67b47b5b2f8c3e7c8472378a4efd
Author: Hongmei Xu <hongmei.xu@oss.qualcomm.com>

arm64: dts: qcom: Add eFuse nvmem cells for Ethernet MAC addresses

This commit adds a QFPROM eFuse node in nord.dtsi with an nvmem-layout
exposing the EMAC0 and EMAC1 MAC addresses as nvmem cells.

> diff --git a/arch/arm64/boot/dts/qcom/nord.dtsi b/arch/arm64/boot/dts/qcom/nord.dtsi
> index fdbe290350ddd..185db2e19c39c 100644
> --- a/arch/arm64/boot/dts/qcom/nord.dtsi
> +++ b/arch/arm64/boot/dts/qcom/nord.dtsi
> @@ -2116,6 +2116,26 @@ llcc: system-cache-controller@21800000 {
>  				    "llcc_broadcast_base",
>  				    "llcc_broadcast_and_base";
>  		};
> +
> +		efuse: efuse@360d4320 {
> +			compatible = "qcom,nord-qfprom", "qcom,qfprom";
> +			reg = <0x0 0x360d4320 0x0 0x8>;

[Severity: Medium]
Should efuse@360d4320 describe the QFPROM corrected region rather than an
8-byte slice dedicated to Ethernet MACs?

qfprom_probe() claims reg entry 0 exclusively via
devm_platform_get_and_ioremap_resource(), so adding a node for the full
QFPROM corrected region later will fail with -EBUSY unless efuse@360d4320
is removed and DT ABI is broken.  Attaching qcom,efuse-eth-mac as the
device's nvmem-layout also prevents non-MAC fuses from sharing this efuse
node because qcom_eth_mac_add_cells() treats every child as a 6-byte MAC
address.

Describing a standard 0x1000 corrected region at 0x360d4000 (which avoids
0x360d5000) with fixed-layout and per-cell post-processing would let MAC
cells and general QFPROM fuses coexist.

> +
> +			nvmem-layout {
> +				compatible = "qcom,efuse-eth-mac";
> +				#address-cells = <1>;
> +				#size-cells = <1>;

[Severity: Medium]
Does compatible = "qcom,efuse-eth-mac" fail make dtbs_check here?

Commit "dt-bindings: nvmem: layouts: add Qualcomm eFuse Ethernet MAC
layout" sets select: false in qcom,efuse-eth-mac.yaml without adding a
$ref entry to
Documentation/devicetree/bindings/nvmem/layouts/nvmem-layout.yaml, so
the schema is never applied and dt-validate rejects this node in
nord-ride.dtb and nord-rrd.dtb.

In addition, the example in qcom,efuse-eth-mac.yaml puts a 4-cell reg
property at the example root without a 2-cell parent node, failing
make dt_binding_check against qcom,qfprom.yaml.

[Severity: Medium]
Does the qcom,efuse-eth-mac driver drop fw_devlink consumer links for
eth0_mac and eth1_mac during probe?

In commit "nvmem: layouts: add Qualcomm eFuse Ethernet MAC address layout
driver", qcom_eth_mac_add_cells() calls fw_devlink_purge_absent_suppliers()
on each child node.  That deletes all consumer fwnode links before
device_links_driver_bound() runs fw_devlink_pickup_dangling_consumers() to
move them onto layout->dev as managed device links, breaking
supplier/consumer suspend, shutdown, unbind, and sync_state ordering.

It also leaves earlier cells' consumer links permanently purged if a later
cell fails validation during probe.  Dropping that call lets driver core
handle the child fwnodes on bind, as fixed-layout.c does.

> +
> +				eth0_mac: eth0-mac@0 {
> +					reg = <0x0 0x6>;
> +				};
> +
> +				eth1_mac: eth1-mac@0 {
> +					reg = <0x0 0x7>;
> +					byte-mask = <0x5f>;
> +				};

[Severity: Low]
Will eth0-mac@0 and eth1-mac@0 trigger a dtc duplicate unit-address warning
on W=1 and dtbs_check builds?

Both enabled sibling nodes share @0, which fails
-Wunique_unit_address_if_enabled, and instance-numbered names (eth0-mac,
eth1-mac) conflict with generic Devicetree node-naming guidelines.
Modeling the shared 7-byte region as one generic cell at @0 with
#nvmem-cell-cells = <1> would avoid both issues.

[Severity: High]
Can reading eth1-mac@0 trigger a use-after-free of cell->priv in
qcom_eth_mac_post_process()?

In commit "nvmem: layouts: add Qualcomm eFuse Ethernet MAC address layout
driver", qcom_eth_mac_add_cells() allocates priv with
devm_kzalloc(&layout->dev, ...) and attaches it to a cell registered on
the parent nvmem->cells list.  When the layout driver is unbound or
unloaded, nvmem_layout_unregister() is an empty stub that leaves the cell
live in sysfs while device_unbind_cleanup() frees priv via
devres_release_all().

Reading the cell via sysfs afterward invokes qcom_eth_mac_post_process()
on the freed priv (passing p->raw_len to kmemdup() and reading
p->byte_mask and p->dev), and jumps into unmapped module text if the
module was unloaded.  The same dangling priv occurs if
qcom_eth_mac_add_cells() fails on a later child after registering an
earlier byte-masked cell.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261204-nvmem-byte-mask-for-split-macaddr-v5-0-13c12a99383f@oss.qualcomm.com?part=5

      reply	other threads:[~2026-12-04  6:43 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04  6:22 [PATCH v5 0/5] nvmem: add Qualcomm eFuse Ethernet MAC address layout driver Hongmei Xu
2026-12-04  6:22 ` [PATCH v5 1/5] dt-bindings: nvmem: layouts: add Qualcomm eFuse Ethernet MAC layout Hongmei Xu
2026-12-04  6:40   ` sashiko-bot
2026-12-04 13:07   ` Rob Herring (Arm)
2026-12-05  3:21   ` Krzysztof Kozlowski
2026-12-04  6:22 ` [PATCH v5 2/5] nvmem: layouts: add Qualcomm eFuse Ethernet MAC address layout driver Hongmei Xu
2026-12-04  6:53   ` sashiko-bot
2026-12-04  6:22 ` [PATCH v5 3/5] MAINTAINERS: add entry for Qualcomm Ethernet MAC nvmem " Hongmei Xu
2026-12-04  6:22 ` [PATCH v5 4/5] arm64: defconfig: enable NVMEM_LAYOUT_QCOM_ETH_MAC Hongmei Xu
2026-12-04  6:30   ` sashiko-bot
2026-12-05  3:19   ` Krzysztof Kozlowski
2026-12-04  6:22 ` [PATCH v5 5/5] arm64: dts: qcom: Add eFuse nvmem cells for Ethernet MAC addresses Hongmei Xu
2026-12-04  6:43   ` sashiko-bot [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-249242@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=hongmei.xu@oss.qualcomm.com \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.