All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Deepanshu Kartikey" <kartikey406@gmail.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/i915: Guard against NULL driver_data in i915_pci_probe()
Date: Sun, 09 Aug 2026 09:12:42 +0000	[thread overview]
Message-ID: <20260809091243.425D51F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260809090430.20577-1-kartikey406@gmail.com>

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

Pre-existing issues:
- [High] The exact same NULL-pointer dereference vulnerability fixed in `drm/i915` also exists in the sibling driver `drm/xe`.
--

--- Patch [1]: [PATCH] drm/i915: Guard against NULL driver_data in i915_pci_probe() ---
commit 88147f0f2fd48d4b9d650095dee423ce2e3c8939
Author: Deepanshu Kartikey <kartikey406@gmail.com>

drm/i915: Guard against NULL driver_data in i915_pci_probe()

This commit fixes a NULL pointer dereference in i915_pci_probe() when a
device is force-bound via sysfs driver_override, which results in a NULL
driver_data being returned by pci_match_device().

Link: https://syzkaller.appspot.com/bug?extid=db96c5ff032f4292a8dc

> diff --git a/drivers/gpu/drm/i915/i915_pci.c b/drivers/gpu/drm/i915/i915_pci.c
> index 82415af47d540..2f03f95945f1b 100644
> --- a/drivers/gpu/drm/i915/i915_pci.c
> +++ b/drivers/gpu/drm/i915/i915_pci.c
> @@ -958,6 +958,9 @@ static int i915_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
>  		(struct intel_device_info *) ent->driver_data;
>  	int err;
>  
> +	if (!intel_info)
> +		return -ENODEV;

[Severity: High]
This is a pre-existing issue, but does the exact same vulnerability exist in
the sibling drm/xe driver?

When a device is force-bound via the sysfs driver_override interface,
xe_pci_probe() in drivers/gpu/drm/xe/xe_pci.c will also receive a dummy
entry where ent->driver_data is NULL. This is cast to desc and passed
directly to find_subplatform():

drivers/gpu/drm/xe/xe_pci.c:xe_pci_probe() {
    ...
    const struct xe_device_desc *desc = (const void *)ent->driver_data;
    ...
    subplatform_desc = find_subplatform(desc, pdev->device);
    ...
}

Inside find_subplatform(), this pointer is unconditionally dereferenced:

drivers/gpu/drm/xe/xe_pci.c:find_subplatform() {
    ...
    for (sp = desc->subplatforms; sp && sp->subplatform; sp++)
    ...
}

Should a similar guard be added to xe_pci_probe() to prevent a kernel
panic there as well?

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

      reply	other threads:[~2026-08-09  9:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-09  9:04 [PATCH] drm/i915: Guard against NULL driver_data in i915_pci_probe() Deepanshu Kartikey
2026-08-09  9:12 ` 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=20260809091243.425D51F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=kartikey406@gmail.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.