From: sashiko-bot@kernel.org
To: "Lyude Paul" <lyude@redhat.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 2/4] drm/nouveau/kms: Check nouveau.atomic parameter after nvif_device_ctor()
Date: Thu, 30 Jul 2026 01:18:52 +0000 [thread overview]
Message-ID: <20260730011853.2AD971F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260730010828.1056397-3-lyude@redhat.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
New issues:
- [Medium] The shared initialization function nouveau_drm_device_new() incorrectly hardcodes modifications to the global driver_pci struct instead of the provided drm_driver parameter.
Pre-existing issues:
- [High] nouveau_drm_device_del() attempts to release an error pointer if drm_dev_alloc() fails, causing a kernel panic.
--
--- Patch [2]: [PATCH 2/4] drm/nouveau/kms: Check nouveau.atomic parameter after nvif_device_ctor() ---
commit c020f75bf537ed725d051dbe5e66bd9bd3dfb6b7
Author: Lyude Paul <lyude@redhat.com>
drm/nouveau/kms: Check nouveau.atomic parameter after nvif_device_ctor()
This commit moves the check for the nouveau.atomic parameter into
nouveau_drm_device_new() so it occurs after the NVIF device is ready.
> diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c
> index ad693d2849bec..8899f009f825e 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_drm.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
> @@ -727,7 +727,7 @@ nouveau_drm_device_del(struct nouveau_drm *drm)
> }
>
> static struct nouveau_drm *
> -nouveau_drm_device_new(const struct drm_driver *drm_driver, struct device *parent,
> +nouveau_drm_device_new(struct drm_driver *drm_driver, struct device *parent,
> struct nvkm_device *device)
> {
[Severity: High]
This is a pre-existing issue, but does the error path in
nouveau_drm_device_new() cause a crash if drm_dev_alloc() fails?
If drm_dev_alloc() fails, it returns an error pointer which is stored
directly in drm->dev:
drivers/gpu/drm/nouveau/nouveau_drm.c:nouveau_drm_device_new() {
...
drm->dev = drm_dev_alloc(drm_driver, parent);
if (IS_ERR(drm->dev)) {
ret = PTR_ERR(drm->dev);
goto done;
}
...
done:
if (ret) {
nouveau_drm_device_del(drm);
...
}
Then in nouveau_drm_device_del(), the truthiness check will succeed for
the error pointer, leading to a panic when it is passed to drm_dev_put():
drivers/gpu/drm/nouveau/nouveau_drm.c:nouveau_drm_device_del() {
if (drm->dev)
drm_dev_put(drm->dev);
...
}
Could we clear drm->dev on allocation failure, or check for IS_ERR()
in the cleanup function?
[ ... ]
> @@ -770,6 +770,9 @@ nouveau_drm_device_new(const struct drm_driver *drm_driver, struct device *paren
> goto done;
> }
>
> + if (nouveau_atomic)
> + driver_pci.driver_features |= DRIVER_ATOMIC;
[Severity: Medium]
Does this unintentionally modify the global driver_pci struct instead of the
drm_driver parameter passed to nouveau_drm_device_new()?
If nouveau_drm_device_new() is called for a platform device (such as Tegra),
the platform driver template would miss the DRIVER_ATOMIC flag, and the
PCI driver template would be unexpectedly mutated instead.
Should this update drm_driver->driver_features rather than driver_pci?
> +
> ret = nvif_device_map(&drm->device);
> if (ret) {
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260730010828.1056397-1-lyude@redhat.com?part=2
next prev parent reply other threads:[~2026-07-30 1:18 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-30 0:56 [PATCH 0/4] drm/nouveau: Enable atomic modesetting by default Lyude Paul
2026-07-30 0:56 ` Lyude Paul
2026-07-30 0:56 ` [PATCH 1/4] drm/nouveau: Print the nouveau.atomic parameter in nouveau_display_options() Lyude Paul
2026-07-30 0:56 ` Lyude Paul
2026-07-30 0:56 ` [PATCH 2/4] drm/nouveau/kms: Check nouveau.atomic parameter after nvif_device_ctor() Lyude Paul
2026-07-30 0:56 ` Lyude Paul
2026-07-30 1:18 ` sashiko-bot [this message]
2026-07-30 0:56 ` [PATCH 3/4] drm/nouveau/kms: Only allow enabling atomic modesetting on nv50+ Lyude Paul
2026-07-30 0:56 ` Lyude Paul
2026-07-30 1:24 ` sashiko-bot
2026-07-30 0:56 ` [PATCH 4/4] drm/nouveau/kms/nv50-: Enable atomic modesetting by default Lyude Paul
2026-07-30 0:56 ` Lyude Paul
2026-07-30 1:21 ` 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=20260730011853.2AD971F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=lyude@redhat.com \
--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.