All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Pengpeng Hou" <pengpeng@iscas.ac.cn>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/nouveau: validate MXMS descriptor bounds
Date: Mon, 06 Jul 2026 09:55:45 +0000	[thread overview]
Message-ID: <20260706095545.AE8461F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260706093949.82126-1-pengpeng@iscas.ac.cn>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] Missing validation of the ACPI WMI evaluation output can cause a NULL pointer dereference.
--

commit d046b4257d93287fd7148175e8bfb0fc2ce27ed6
Author: Pengpeng Hou <pengpeng@iscas.ac.cn>

drm/nouveau: validate MXMS descriptor bounds

This commit adds bounds checking for MXMS descriptors. It retains the provider
buffer size with the MXMS data, validates fixed headers, and verifies
descriptor arrays against the remaining buffer size.

> diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/mxm/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/mxm/base.c
> index 26ec50b66e667..ad74a216a201d 100644
> --- a/drivers/gpu/drm/nouveau/nvkm/subdev/mxm/base.c
> +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/mxm/base.c

[ ... ]

> @@ -188,6 +201,8 @@ mxm_shadow_wmi(struct nvkm_mxm *mxm, u8 version)
>  	if (obj->type == ACPI_TYPE_BUFFER) {

[Severity: High]
This is a pre-existing issue, but can wmi_evaluate_method() return success
while leaving retn.pointer as NULL?

If the BIOS WMI implementation returns void, obj (assigned from retn.pointer
just before this block) would be NULL. Does this code risk a NULL pointer
dereference around line 197 when accessing obj->type in mxm_shadow_wmi() in
base.c without verifying the pointer first?

A similar condition appears to exist around line 153 in wmi_wmmx_mxmi() where
retn.pointer is also dereferenced without validation.

>  		mxm->mxms = kmemdup(obj->buffer.pointer,
>  				    obj->buffer.length, GFP_KERNEL);
> +		if (mxm->mxms)
> +			mxm->mxms_size = obj->buffer.length;
>  	}
>  
>  	kfree(obj);

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260706093949.82126-1-pengpeng@iscas.ac.cn?part=1

      reply	other threads:[~2026-07-06  9:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-06  9:39 [PATCH] drm/nouveau: validate MXMS descriptor bounds Pengpeng Hou
2026-07-06  9:39 ` Pengpeng Hou
2026-07-06  9:55 ` 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=20260706095545.AE8461F00A3A@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=pengpeng@iscas.ac.cn \
    --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.