From: Georgiy Osokin <g.osokin@auroraos.dev>
To: Jens Wiklander <jenswi@kernel.org>
Cc: Sumit Garg <sumit.garg@kernel.org>,
<op-tee@lists.trustedfirmware.org>,
<linux-kernel@vger.kernel.org>,
Georgiy Osokin <g.osokin@auroraos.dev>, <stable@vger.kernel.org>,
<lvc-project@linuxtesting.org>
Subject: [PATCH] tee: shm: don't warn on an oversized page array in register_shm_helper()
Date: Sat, 24 Oct 2026 00:02:38 +0300 [thread overview]
Message-ID: <20261023210238.551855-1-g.osokin@auroraos.dev> (raw)
register_shm_helper() sizes shm->pages from the length passed to
TEE_IOC_SHM_REGISTER and allocates it with kzalloc_objs(). A length above
2 GiB makes the array larger than the page allocator can serve in one
block (MAX_PAGE_ORDER), so it trips its order warning; on a panic_on_warn
kernel that is a panic.
The size comes from userspace and the request fails with -ENOMEM anyway,
so pass __GFP_NOWARN. kvzalloc_objs() would not help since kvmalloc
warns above INT_MAX as well.
Fixes: 033ddf12bcf5 ("tee: add register user memory")
Cc: stable@vger.kernel.org
Cc: lvc-project@linuxtesting.org
Signed-off-by: Georgiy Osokin <g.osokin@auroraos.dev>
---
drivers/tee/tee_shm.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/tee/tee_shm.c b/drivers/tee/tee_shm.c
index 6742b35..d539988 100644
--- a/drivers/tee/tee_shm.c
+++ b/drivers/tee/tee_shm.c
@@ -438,7 +438,8 @@ register_shm_helper(struct tee_context *ctx, struct iov_iter *iter, u32 flags,
goto err_free_shm;
}
- shm->pages = kzalloc_objs(*shm->pages, num_pages);
+ shm->pages = kzalloc_objs(*shm->pages, num_pages,
+ GFP_KERNEL | __GFP_NOWARN);
if (!shm->pages) {
ret = ERR_PTR(-ENOMEM);
goto err_free_shm;
base-commit: 72d3fcf802c45d00b300f25b848a93c3a2bd7c7e
--
2.54.0
reply other threads:[~2026-10-23 21:03 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20261023210238.551855-1-g.osokin@auroraos.dev \
--to=g.osokin@auroraos.dev \
--cc=jenswi@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lvc-project@linuxtesting.org \
--cc=op-tee@lists.trustedfirmware.org \
--cc=stable@vger.kernel.org \
--cc=sumit.garg@kernel.org \
/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
all inboxes | Powered by JetHome®