mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Amirreza Zarrabi <amirreza.zarrabi@oss.qualcomm.com>
To: Jens Wiklander <jens.wiklander@oss.qualcomm.com>,
	HyeongJun An <sammiee5311@gmail.com>
Cc: Jens Wiklander <jens.wiklander@linaro.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: qcomtee: user: check the parameter count from the supplicant
Date: Thu, 5 Nov 2026 06:37:45 +1100	[thread overview]
Message-ID: <6f2f8357-59ef-491b-95f2-d58feb362ba7@oss.qualcomm.com> (raw)
In-Reply-To: <CAGgiveUc+TkGyGDxuuCLpHO=i22-4fn1CqjqnnmWLdWWYOZfPA@mail.gmail.com>

Hi Jens,

On 11/4/2026 4:58 AM, Jens Wiklander wrote:
> Hi,
> 
> On Wed, Aug 5, 2026 at 11:23 AM HyeongJun An <sammiee5311@gmail.com> wrote:
>>
>> 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
>>
> 
> Looks good. Amir, do you agree?

Yes. It's correct. The check is missing.

Reviewed-by: Amirreza Zarrabi <amirreza.zarrabi@oss.qualcomm.com>

Best Regards,
Amir

> 
> Cheers,
> Jens


      reply	other threads:[~2026-11-04 19:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-30  6:22 HyeongJun An
2026-11-03 17:58 ` Jens Wiklander
2026-11-04 19:37   ` Amirreza Zarrabi [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=6f2f8357-59ef-491b-95f2-d58feb362ba7@oss.qualcomm.com \
    --to=amirreza.zarrabi@oss.qualcomm.com \
    --cc=jens.wiklander@linaro.org \
    --cc=jens.wiklander@oss.qualcomm.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=op-tee@lists.trustedfirmware.org \
    --cc=sammiee5311@gmail.com \
    --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®