From: Sumit Garg <sumit.garg@kernel.org>
To: Amirreza Zarrabi <amirreza.zarrabi@oss.qualcomm.com>
Cc: Jens Wiklander <jenswi@kernel.org>,
Sumit Garg <sumit.garg@kernel.org>,
linux-arm-msm@vger.kernel.org, op-tee@lists.trustedfirmware.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] tee: optee: allocate a bitmap for all valid notification keys
Date: Mon, 19 Oct 2026 17:18:49 +0530 [thread overview]
Message-ID: <atYDodGDc3z6Qv4f@sumit-xelite> (raw)
In-Reply-To: <20261009-fix-tee-max-keys-v1-1-1462d96bf438@oss.qualcomm.com>
On Fri, 09 Oct 2026 at 20:19:48 -0700, Amirreza Zarrabi wrote:
>Notification keys are checked against an inclusive maximum, but
>optee_notif_init() passes that maximum to bitmap_zalloc() as the number of
>bits. The bitmap is therefore one bit short. When the maximum key is a
>multiple of BITS_PER_LONG, accessing that key reads or writes beyond the
>allocated bitmap. Word rounding masks the problem.
>
>Allocate max_key + 1 bits so that the highest valid key has storage.
>
>Fixes: 787c80cc7b22 ("optee: separate notification functions")
>Signed-off-by: Amirreza Zarrabi <amirreza.zarrabi@oss.qualcomm.com>
>---
> drivers/tee/optee/notif.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Sumit Garg <sumit.garg@oss.qualcomm.com>
-Sumit
>
>diff --git a/drivers/tee/optee/notif.c b/drivers/tee/optee/notif.c
>index 68014222d7be..2bf5ce397233 100644
>--- a/drivers/tee/optee/notif.c
>+++ b/drivers/tee/optee/notif.c
>@@ -114,7 +114,7 @@ int optee_notif_init(struct optee *optee, u_int max_key)
> {
> spin_lock_init(&optee->notif.lock);
> INIT_LIST_HEAD(&optee->notif.db);
>- optee->notif.bitmap = bitmap_zalloc(max_key, GFP_KERNEL);
>+ optee->notif.bitmap = bitmap_zalloc(max_key + 1, GFP_KERNEL);
> if (!optee->notif.bitmap)
> return -ENOMEM;
>
>
>---
>base-commit: becb95e45ef0dda9ffb35156d909d3da7a2789c3
>change-id: 20261009-fix-tee-max-keys-50f2db87b4e5
>
>Best regards,
>--
>Amirreza Zarrabi <amirreza.zarrabi@oss.qualcomm.com>
>
prev parent reply other threads:[~2026-10-19 11:48 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-10 3:19 Amirreza Zarrabi
2026-10-19 11:48 ` Sumit Garg [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=atYDodGDc3z6Qv4f@sumit-xelite \
--to=sumit.garg@kernel.org \
--cc=amirreza.zarrabi@oss.qualcomm.com \
--cc=jenswi@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=op-tee@lists.trustedfirmware.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®