mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ekansh Gupta <quic_ekangupt@quicinc.com>
To: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Cc: <srinivas.kandagatla@linaro.org>, <linux-arm-msm@vger.kernel.org>,
	<gregkh@linuxfoundation.org>, <quic_bkumar@quicinc.com>,
	<linux-kernel@vger.kernel.org>, <quic_chennak@quicinc.com>,
	stable <stable@kernel.org>
Subject: Re: [PATCH v3 2/9] misc: fastrpc: Fix DSP capabilities request
Date: Mon, 3 Jun 2024 11:45:26 +0530	[thread overview]
Message-ID: <1272b70e-fe2f-47cd-af77-6d3461b8596c@quicinc.com> (raw)
In-Reply-To: <zcqc4dgc6pippwiysybmkbvogfd6gbinnrw65kiulie3wlup5y@wq4dexvamo7t>


On 5/30/2024 4:29 PM, Dmitry Baryshkov wrote:
> On Thu, May 30, 2024 at 03:50:20PM +0530, Ekansh Gupta wrote:
>> Incorrect remote arguments are getting passed when requesting for
>> capabilities from DSP.
> Describe why and how they are incorrect.

Sure, I'll update this information in the next spin.

>
>> Also there is no requirement to update the
>> PD type as it might cause problems for any PD other than user PD.
> Also... means that these are two separate issues. There should be two
> separate commits.

Okay, I'll separate out the PD type change.

>
>> In addition to this, the collected capability information is not
>> getting copied properly to user. Add changes to address these
>> problems and get correct DSP capabilities.
>>
>> Fixes: 6c16fd8bdd40 ("misc: fastrpc: Add support to get DSP capabilities")
>> Cc: stable <stable@kernel.org>
>> Signed-off-by: Ekansh Gupta <quic_ekangupt@quicinc.com>
>> ---
>>   drivers/misc/fastrpc.c | 7 +++----
>>   1 file changed, 3 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c
>> index 4028cb96bcf2..61389795f498 100644
>> --- a/drivers/misc/fastrpc.c
>> +++ b/drivers/misc/fastrpc.c
>> @@ -1700,9 +1700,8 @@ static int fastrpc_get_info_from_dsp(struct fastrpc_user *fl, uint32_t *dsp_attr
>>   	args[0].length = sizeof(dsp_attr_buf_len);
>>   	args[0].fd = -1;
>>   	args[1].ptr = (u64)(uintptr_t)&dsp_attr_buf[1];
>> -	args[1].length = dsp_attr_buf_len;
>> +	args[1].length = dsp_attr_buf_len * sizeof(uint32_t);
> As you are skipping first entry, should there be (dsp_attr_buf_len - 1)
> * sizeof(uint32_t).

This was done in the next patch of the series, I'll bring it here.

>
>>   	args[1].fd = -1;
>> -	fl->pd = USER_PD;
>>   
>>   	return fastrpc_internal_invoke(fl, true, FASTRPC_DSP_UTILITIES_HANDLE,
>>   				       FASTRPC_SCALARS(0, 1, 1), args);
>> @@ -1730,7 +1729,7 @@ static int fastrpc_get_info_from_kernel(struct fastrpc_ioctl_capability *cap,
>>   	if (!dsp_attributes)
>>   		return -ENOMEM;
>>   
>> -	err = fastrpc_get_info_from_dsp(fl, dsp_attributes, FASTRPC_MAX_DSP_ATTRIBUTES_LEN);
>> +	err = fastrpc_get_info_from_dsp(fl, dsp_attributes, FASTRPC_MAX_DSP_ATTRIBUTES);
> So it looks like the argument was correct. It was passing length, not
> the number of attributes. The only thing to fix is that args[1].length
> should be dsp_attr_buf_len - sizeof(*dsp_attr_buf).

args[0] is expected to carry the information about the total number of attributes to be copied from DSP
and not the information about the size to be copied. Passing the size information leads to a failure
suggesting bad arguments passed to DSP.

>
>>   	if (err == DSP_UNSUPPORTED_API) {
>>   		dev_info(&cctx->rpdev->dev,
>>   			 "Warning: DSP capabilities not supported on domain: %d\n", domain);
>> @@ -1783,7 +1782,7 @@ static int fastrpc_get_dsp_info(struct fastrpc_user *fl, char __user *argp)
>>   	if (err)
>>   		return err;
>>   
>> -	if (copy_to_user(argp, &cap.capability, sizeof(cap.capability)))
>> +	if (copy_to_user(argp, &cap, sizeof(cap)))
>>   		return -EFAULT;
>>   
>>   	return 0;
>> -- 
>> 2.43.0
>>

  reply	other threads:[~2024-06-03  6:15 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-30 10:20 [PATCH v3 0/9] Add missing features to FastRPC driver Ekansh Gupta
2024-05-30 10:20 ` [PATCH v3 1/9] misc: fastrpc: Add missing dev_err newlines Ekansh Gupta
2024-05-30 10:20 ` [PATCH v3 2/9] misc: fastrpc: Fix DSP capabilities request Ekansh Gupta
2024-05-30 10:59   ` Dmitry Baryshkov
2024-06-03  6:15     ` Ekansh Gupta [this message]
2024-06-03  9:54       ` Dmitry Baryshkov
2024-05-31  9:33   ` Srinivas Kandagatla
2024-06-03  7:05     ` Ekansh Gupta
2024-06-03  9:56       ` Dmitry Baryshkov
2024-05-30 10:20 ` [PATCH v3 3/9] misc: fastrpc: Fix memory corruption in DSP capabilities Ekansh Gupta
2024-05-30 11:00   ` Dmitry Baryshkov
2024-05-31  9:36   ` Srinivas Kandagatla
2024-06-03  6:23     ` Ekansh Gupta
2024-05-30 10:20 ` [PATCH v3 4/9] misc: fastrpc: Add static PD restart support Ekansh Gupta
2024-05-30 11:04   ` Dmitry Baryshkov
2024-06-03 10:53   ` Caleb Connolly
2024-06-04  9:23     ` Bharath Kumar V
2024-06-04  9:34       ` Dmitry Baryshkov
2024-06-04 11:24       ` Caleb Connolly
2024-05-30 10:20 ` [PATCH v3 5/9] misc: fastrpc: Redesign remote heap management Ekansh Gupta
2024-05-30 11:14   ` Dmitry Baryshkov
2024-06-03  6:25     ` Ekansh Gupta
2024-05-30 10:20 ` [PATCH v3 6/9] misc: fastrpc: Fix unsigned PD support Ekansh Gupta
2024-05-30 23:44   ` Dmitry Baryshkov
2024-05-30 10:20 ` [PATCH v3 7/9] misc: fastrpc: Restrict untrusted app to attach to privileged PD Ekansh Gupta
2024-05-30 23:46   ` Dmitry Baryshkov
2024-05-31  9:48   ` Srinivas Kandagatla
2024-05-30 10:20 ` [PATCH v3 8/9] misc: fastrpc: Restrict untrusted app to spawn signed PD Ekansh Gupta
2024-05-30 23:49   ` Dmitry Baryshkov
2024-06-03  6:27     ` Ekansh Gupta
2024-06-03 10:02       ` Dmitry Baryshkov
2024-06-06  7:22         ` Ekansh Gupta
2024-05-30 10:20 ` [PATCH v3 9/9] misc: fastrpc: Add system unsigned PD support Ekansh Gupta
2024-05-30 23:50   ` Dmitry Baryshkov

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=1272b70e-fe2f-47cd-af77-6d3461b8596c@quicinc.com \
    --to=quic_ekangupt@quicinc.com \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=quic_bkumar@quicinc.com \
    --cc=quic_chennak@quicinc.com \
    --cc=srinivas.kandagatla@linaro.org \
    --cc=stable@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®