Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Vyacheslav Yurkov" <V.Yurkov.EXT@bruker.com>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v3 2/2] bus: Add Altera AXI Timeout Bridge driver
Date: Fri, 20 Nov 2026 09:32:01 +0000	[thread overview]
Message-ID: <sashiko-outbox-224851@kernel.org> (raw)
In-Reply-To: <20261120-feature-timeout-ip-v3-2-affcc644af5e@bruker.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] bus: altera-timeout-bridge: NULL deref in
  altera_timeout_bridge_probe()
--

commit 2329d1b64f843a3b75217e8d1da80bb7857bd24f
Author: Vyacheslav Yurkov <V.Yurkov.EXT@bruker.com>

bus: Add Altera AXI Timeout Bridge driver

This commit adds a bus driver for the Altera AXI Timeout Bridge that
populates child peripherals behind the bridge, handles timeout interrupts,
and exposes timeout count and address attributes via sysfs.

> diff --git a/drivers/bus/altera-timeout-bridge.c b/drivers/bus/altera-timeout-bridge.c
> new file mode 100644
> index 0000000000000..dd84096ec694d
> --- /dev/null
> +++ b/drivers/bus/altera-timeout-bridge.c
> @@ -0,0 +1,184 @@

[ ... ]

> +static int altera_timeout_bridge_probe(struct platform_device *pdev)
> +{

[ ... ]

> +	ret = devm_device_add_group(dev, &altera_timeout_bridge_sysfs_group);
> +	if (ret)
> +		return ret;
> +
> +	driver_data->irq_node = sysfs_get_dirent(dev->kobj.sd, "last_timeout_address");
> +	if (!driver_data->irq_node)
> +		return -ENOENT;

[Severity: Medium]
Can sysfs_get_dirent() trigger a NULL pointer dereference or cause probe to
fail when CONFIG_SYSFS is disabled?

ALTERA_TIMEOUT_BRIDGE does not depend on SYSFS.  When CONFIG_SYSFS=n,
devm_device_add_group() is a no-op and dev->kobj.sd remains NULL.  If
CONFIG_KERNFS=y (for example, via CONFIG_CGROUPS), sysfs_get_dirent() passes
parent = NULL into kernfs_find_and_get_ns() -> kernfs_root(), which
dereferences kn->__parent without a NULL check.  If CONFIG_KERNFS=n,
sysfs_get_dirent() returns NULL and altera_timeout_bridge_probe() fails with
-ENOENT before requesting the IRQ or populating child devices.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261120-feature-timeout-ip-v3-0-affcc644af5e@bruker.com?part=2

      reply	other threads:[~2026-11-20  9:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-20  9:24 [PATCH v3 0/2] Add Altera timeout bridge driver Vyacheslav Yurkov via B4 Relay
2026-11-20  9:24 ` [PATCH v3 1/2] dt-bindings: bus: Add Altera AXI Timeout Bridge Vyacheslav Yurkov via B4 Relay
2026-11-20  9:32   ` sashiko-bot
2026-11-20  9:24 ` [PATCH v3 2/2] bus: Add Altera AXI Timeout Bridge driver Vyacheslav Yurkov via B4 Relay
2026-11-20  9:32   ` 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-224851@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=V.Yurkov.EXT@bruker.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox