All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Svyatoslav Ryhel" <clamor95@gmail.com>
Cc: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org,
	robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v9 01/13] drm: Add MIPI DBI bus support for MIPI DBI Type A and B
Date: Mon, 30 Nov 2026 11:55:02 +0000	[thread overview]
Message-ID: <sashiko-outbox-240986@kernel.org> (raw)
In-Reply-To: <20261130114155.72920-2-clamor95@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] drm: NULL pointer dereference in mipi_dbi_bus_shutdown() on
  unbound device
--

commit a575546c0815e7093e5a3e166f417f51579ae7fa
Author: Svyatoslav Ryhel <clamor95@gmail.com>

drm: Add MIPI DBI bus support for MIPI DBI Type A and B

This commit adds a Linux driver model bus and helpers for MIPI DBI Type A
and Type B hosts and peripherals.

> diff --git a/drivers/gpu/drm/drm_mipi_dbi_bus.c b/drivers/gpu/drm/drm_mipi_dbi_bus.c
> new file mode 100644
> index 0000000000000..0c9b93d72021b
> --- /dev/null
> +++ b/drivers/gpu/drm/drm_mipi_dbi_bus.c
> @@ -0,0 +1,265 @@

[ ... ]

> +static void mipi_dbi_bus_shutdown(struct device *dev)
> +{
> +	struct mipi_dbi_driver *drv = to_mipi_dbi_driver(dev->driver);
> +	struct mipi_dbi_device *dbidev = to_mipi_dbi_device(dev);
> +
> +	if (drv->shutdown)
> +		drv->shutdown(dbidev);
> +}
> +
> +static const struct bus_type mipi_dbi_bus_type = {
> +	.name = "mipi-dbi",
> +	.match = of_driver_match_device,
> +	.uevent = of_device_uevent_modalias,
> +	.probe = mipi_dbi_bus_probe,
> +	.remove = mipi_dbi_bus_remove,
> +	.shutdown = mipi_dbi_bus_shutdown,
> +};

[Severity: High]
Can mipi_dbi_bus_shutdown() cause a NULL pointer dereference when a
registered mipi_dbi_device has no bound driver?

device_shutdown() invokes dev->bus->shutdown(dev) unconditionally without
checking whether dev->driver is set:

drivers/base/core.c:device_shutdown() {
    ...
		if (dev->bus && dev->bus->shutdown) {
			if (initcall_debug)
				dev_info(dev, "shutdown\n");
			dev->bus->shutdown(dev);
		} else if (dev->driver && dev->driver->shutdown) {
    ...
}

Because driver is the first member of struct mipi_dbi_driver,
to_mipi_dbi_driver(NULL) evaluates to NULL and checking drv->shutdown
dereferences NULL during system shutdown if a peripheral driver was not
loaded, deferred probing, or was unbound.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261130114155.72920-1-clamor95@gmail.com?part=1

  reply	other threads:[~2026-11-30 11:55 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-30 11:41 [PATCH v9 00/13] drm/tegra: Add support for Tegra20/Tegra30 8-bit CPU interface Svyatoslav Ryhel
2026-11-30 11:41 ` [PATCH v9 01/13] drm: Add MIPI DBI bus support for MIPI DBI Type A and B Svyatoslav Ryhel
2026-11-30 11:55   ` sashiko-bot [this message]
2026-11-30 11:41 ` [PATCH v9 02/13] drm/panel: panel-hitachi-tx10d07vm0baa: Convert to use MIPI DBI bus Svyatoslav Ryhel
2026-11-30 11:41 ` [PATCH v9 03/13] drm/panel: panel-hitachi-tx10d07vm0baa: Convert to mipi_dbi_write_seq_multi() Svyatoslav Ryhel
2026-11-30 11:41 ` [PATCH v9 04/13] drm/panel: panel-lg-lh400wv3: Convert to use MIPI DBI bus Svyatoslav Ryhel
2026-11-30 11:41 ` [PATCH v9 05/13] drm/panel: panel-lg-lh400wv3: Convert to mipi_dbi_write_seq_multi() Svyatoslav Ryhel
2026-11-30 11:41 ` [PATCH v9 06/13] drm/tegra: dc: Add elements required by Tegra MIPI DBI Svyatoslav Ryhel
2026-11-30 11:41 ` [PATCH v9 07/13] dt-bindings: display: tegra: Document Tegra20 DSI port Svyatoslav Ryhel
2026-11-30 11:41 ` [PATCH v9 08/13] drm/tegra: output: Make panel parsing configurable Svyatoslav Ryhel
2026-11-30 11:41 ` [PATCH v9 09/13] drm/tegra: Convert to use atomic versions of drm_encoder_helper_funcs Svyatoslav Ryhel
2026-11-30 11:53   ` sashiko-bot
2026-11-30 11:41 ` [PATCH v9 10/13] dt-bindings: display: tegra: Document nvidia,contiguous-rgb-pins property Svyatoslav Ryhel
2026-11-30 11:41   ` [PATCH v9 10/13] dt-bindings: display: tegra: Document nvidia, contiguous-rgb-pins property Svyatoslav Ryhel
2026-11-30 11:41 ` [PATCH v9 11/13] drm/tegra: rgb: Parameterize configuration based on bus flags and DT property Svyatoslav Ryhel
2026-11-30 11:59   ` sashiko-bot
2026-11-30 11:41 ` [PATCH v9 12/13] dt-bindings: display: tegra: Document 8-bit CPU parallel interface Svyatoslav Ryhel
2026-11-30 13:59   ` Rob Herring (Arm)
2026-11-30 11:41 ` [PATCH v9 13/13] drm/tegra: Add support for 8-bit CPU interface Svyatoslav Ryhel
2026-11-30 12:11   ` sashiko-bot

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-240986@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=clamor95@gmail.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.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 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.