From: Gwan-gyeong Mun <gwan-gyeong.mun@intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: thomas.hellstrom@linux.intel.com, matthew.auld@intel.com,
chris@chris-wilson.co.uk
Subject: [Intel-gfx] [PATCH 4/6] drm/i915: Check if the size is too big while creating shmem file
Date: Fri, 3 Jun 2022 18:38:28 +0900 [thread overview]
Message-ID: <20220603093830.1529520-5-gwan-gyeong.mun@intel.com> (raw)
In-Reply-To: <20220603093830.1529520-1-gwan-gyeong.mun@intel.com>
The __shmem_file_setup() function returns -EINVAL if size is greater than
MAX_LFS_FILESIZE. To handle the same error as other code that returns
-E2BIG when the size is too large, it add a code that returns -E2BIG when
the size is larger than the size that can be handled.
Signed-off-by: Gwan-gyeong Mun <gwan-gyeong.mun@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Matthew Auld <matthew.auld@intel.com>
Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Testcase: igt@gem_create@create-massive
Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/4991
---
drivers/gpu/drm/i915/gem/i915_gem_shmem.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/gpu/drm/i915/gem/i915_gem_shmem.c b/drivers/gpu/drm/i915/gem/i915_gem_shmem.c
index e77f9ada31a3..b4ecca21277e 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_shmem.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_shmem.c
@@ -542,6 +542,15 @@ static int __create_shmem(struct drm_i915_private *i915,
drm_gem_private_object_init(&i915->drm, obj, size);
+ /* XXX: The __shmem_file_setup() function returns -EINVAL if size is
+ * greater than MAX_LFS_FILESIZE.
+ * To handle the same error as other code that returns -E2BIG when
+ * the size is too large, we add a code that returns -E2BIG when the
+ * size is larger than the size that can be handled.
+ */
+ if (size > MAX_LFS_FILESIZE)
+ return -E2BIG;
+
if (i915->mm.gemfs)
filp = shmem_file_setup_with_mnt(i915->mm.gemfs, "i915", size,
flags);
--
2.34.1
next prev parent reply other threads:[~2022-06-03 9:39 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-03 9:38 [Intel-gfx] [PATCH 0/6] Fixes integer overflow or integer truncation issues in page lookups, ttm place configuration and scatterlist creation Gwan-gyeong Mun
2022-06-03 9:38 ` [Intel-gfx] [PATCH 1/6] drm/i915/gem: Typecheck page lookups Gwan-gyeong Mun
2022-06-03 9:38 ` [Intel-gfx] [PATCH 2/6] drm/i915: Check for integer truncation on scatterlist creation Gwan-gyeong Mun
2022-06-03 9:38 ` [Intel-gfx] [PATCH 3/6] drm/i915: Check for integer truncation on the configuration of ttm place Gwan-gyeong Mun
2022-06-03 9:38 ` Gwan-gyeong Mun [this message]
2022-06-03 9:38 ` [Intel-gfx] [PATCH 5/6] drm/i915: Use error code as -E2BIG when the size of gem ttm object is too large Gwan-gyeong Mun
2022-06-15 15:54 ` Das, Nirmoy
2022-06-03 9:38 ` [Intel-gfx] [PATCH 6/6] drm/i915: Remove truncation warning for large objects Gwan-gyeong Mun
2022-06-03 10:31 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for Fixes integer overflow or integer truncation issues in page lookups, ttm place configuration and scatterlist creation (rev2) Patchwork
2022-06-03 10:31 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2022-06-03 12:01 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2022-06-03 13:19 ` [Intel-gfx] [PATCH 0/6] Fixes integer overflow or integer truncation issues in page lookups, ttm place configuration and scatterlist creation Jani Nikula
2022-06-14 8:49 ` Gwan-gyeong Mun
2022-06-03 14:33 ` [Intel-gfx] ✓ Fi.CI.IGT: success for Fixes integer overflow or integer truncation issues in page lookups, ttm place configuration and scatterlist creation (rev2) Patchwork
-- strict thread matches above, loose matches on Subject: below --
2022-06-03 9:24 [Intel-gfx] [PATCH 0/6] Fixes integer overflow or integer truncation issues in page lookups, ttm place configuration and scatterlist creation Gwan-gyeong Mun
2022-06-03 9:24 ` [Intel-gfx] [PATCH 4/6] drm/i915: Check if the size is too big while creating shmem file Gwan-gyeong Mun
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=20220603093830.1529520-5-gwan-gyeong.mun@intel.com \
--to=gwan-gyeong.mun@intel.com \
--cc=chris@chris-wilson.co.uk \
--cc=intel-gfx@lists.freedesktop.org \
--cc=matthew.auld@intel.com \
--cc=thomas.hellstrom@linux.intel.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).