mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] tee: qcomtee: user: check the parameter count from the supplicant
@ 2026-07-30  6:22 HyeongJun An
  2026-11-03 17:58 ` Jens Wiklander
  0 siblings, 1 reply; 3+ messages in thread
From: HyeongJun An @ 2026-07-30  6:22 UTC (permalink / raw)
  To: Amirreza Zarrabi, Jens Wiklander, Sumit Garg
  Cc: linux-arm-msm, op-tee, linux-kernel, HyeongJun An

The qcomtee_cb_params_to_args() walks the argument array QTEE asked for and
indexes the parameter array the supplicant supplied, but it never looks at
num_params. A supplicant that answers TEE_IOC_SUPPL_SEND with fewer
parameters than the request needs makes that walk read past the end of the
allocation.

To fix this, reject a response that is too short, the way ureq_select()
already does for the receive direction.

Fixes: d6e290837e50 ("tee: add Qualcomm TEE driver")
Assisted-by: Claude:claude-opus-5
Signed-off-by: HyeongJun An <sammiee5311@gmail.com>
---
 drivers/tee/qcomtee/user_obj.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/tee/qcomtee/user_obj.c b/drivers/tee/qcomtee/user_obj.c
index 10452fcc7ccb..2a594ae299da 100644
--- a/drivers/tee/qcomtee/user_obj.c
+++ b/drivers/tee/qcomtee/user_obj.c
@@ -507,6 +507,10 @@ static int qcomtee_cb_params_to_args(struct qcomtee_arg *u,
 {
 	int i;
 
+	/* Supplicant can not send fewer parameters than requested. */
+	if (num_params < qcomtee_args_len(u))
+		return -EINVAL;
+
 	qcomtee_arg_for_each(i, u) {
 		switch (u[i].type) {
 		case QCOMTEE_ARG_TYPE_IB:
-- 
2.43.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-04 19:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-30  6:22 [PATCH] tee: qcomtee: user: check the parameter count from the supplicant HyeongJun An
2026-11-03 17:58 ` Jens Wiklander
2026-11-04 19:37   ` Amirreza Zarrabi

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®