[PATCH 5.10] gpu/i915: fix error return in mmap_offset_attach()

Alexandr Sapozhnkiov posted 1 patch 1 week, 2 days ago
drivers/gpu/drm/i915/gem/i915_gem_mman.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
[PATCH 5.10] gpu/i915: fix error return in mmap_offset_attach()
Posted by Alexandr Sapozhnkiov 1 week, 2 days ago
From: Alexandr Sapozhnikov <alsp705@gmail.com>

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.
Signed-off-by: Alexandr Sapozhnikov <alsp705@gmail.com>

---
 drivers/gpu/drm/i915/gem/i915_gem_mman.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_mman.c b/drivers/gpu/drm/i915/gem/i915_gem_mman.c
index a2195e28b625..adaef8f09d59 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_mman.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_mman.c
@@ -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:
-- 
2.43.0
Re: [PATCH 5.10] gpu/i915: fix error return in mmap_offset_attach()
Posted by Krzysztof Karas 1 week, 1 day ago
Hi Alexandr,

> 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:
Reviewed-by: Krzysztof Karas <krzysztof.karas@intel.com>
-- 
Best Regards,
Krzysztof