Skip to contentSkip to conversation

gpu/i915: fix error return in mmap_offset_attach()

PATCH In review Alexandr Sapozhnkiov 3 participants 4 messages Sep 22, 2025 – Sep 24, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gpu/i915: fix error return in mmap_offset_attach()

From: Alexandr Sapozhnikov <[email protected]>

Return value of function 'drm_vma_node_allow', called at i915_gem_mman.c:670, is not checked, but it is usually checked for this function

Found by Linux Verification Center (linuxtesting.org) with SVACE.

---
 drivers/gpu/drm/i915/gem/i915_gem_mman.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/gem/i915_gem_mman.c +5 -2
index a2195e28b625..adaef8f09d59 100644
@@ -706,8 +706,11 @@ mmap_offset_attach(struct drm_i915_gem_object *obj,
 	mmo = insert_mmo(obj, mmo);
 	GEM_BUG_ON(lookup_mmo(obj, mmap_type) != mmo);
 out:
-	if (file)
-		drm_vma_node_allow_once(&mmo->vma_node, file);
+	if (file) {
+		err = drm_vma_node_allow_once(&mmo->vma_node, file);
+		if (err)
+			goto err;
+	}
 	return mmo;
 
 err:
Signature · 1 line
2.43.0
Reviewed-by on v1 1/1
#1 lore raw

Hi Alexandr,

Quoted 3 lines

Return value of function 'drm_vma_node_allow', called at i915_gem_mman.c:670, is not checked, but it is usually checked for this function

Grepping for this function in the repo tells me this is currently the only place we call it. I'd rephrase the commit message to focus only on missing return code.

After that:

Signature · 2 lines
Best Regards,
Krzysztof
#2 lore raw

Hi Krzysztof Karas,

Ignored (unchecked) return values from functions that can fail. While a single unchecked return may look harmless, in aggregate they create a broad
attack surface — a latent, easily-exploitable category of vulnerabilities that can lead to data corruption,
denial-of-service, or privilege escalation when error conditions are hit in the field.

Counter example: /drivers/gpu/drm/drm_prime.c:748:

ret = drm_vma_node_allow(&obj->vma_node, priv);
    if (ret)
        goto out;

Counter example: /drivers/gpu/drm/drm_gem.c:387:

ret = drm_vma_node_allow(&obj->vma_node, file_priv);
    if (ret)
        goto err_remove;

Best Regards,
Alexandr

вт, 23 сент. 2025 г. в 12:07, Krzysztof Karas <[email protected]>:

Quoted 15 lines

Hi Alexandr,

Quoted 3 lines

Return value of function 'drm_vma_node_allow', called at i915_gem_mman.c:670, is not checked, but it is usually checked for this function

Grepping for this function in the repo tells me this is currently the only place we call it. I'd rephrase the commit message to focus only on missing return code.

After that:

--
Best Regards,
Krzysztof

#3 lore raw

✗ LGCI.VerificationFailed: failure for gpu/i915: fix error return in mmap_offset_attach()

In reply to Alexandr Sapozhnkiov
== Series Details ==

== Series Details ==

Series: gpu/i915: fix error return in mmap_offset_attach()
URL : https://patchwork.freedesktop.org/series/154966/
State : failure

== Summary ==

Address '[email protected]' is not on the allowlist, which prevents CI from being triggered for this patch. If you want Intel GFX CI to accept this address, please contact the script maintainers at [email protected]. Exception occurred during validation, bailing out!