linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1] misc: fastrpc: Reassign memory ownership only for remote heap
@ 2023-03-21 10:21 Ekansh Gupta
  2023-03-21 20:53 ` Srinivas Kandagatla
  2023-05-12 14:54 ` Srinivas Kandagatla
  0 siblings, 2 replies; 5+ messages in thread
From: Ekansh Gupta @ 2023-03-21 10:21 UTC (permalink / raw)
  To: srinivas.kandagatla, linux-arm-msm
  Cc: Ekansh Gupta, ekangupt, gregkh, linux-kernel, bkumar,
	fastrpc.upstream, stable

The userspace map request for remote heap allocates CMA memory.
The ownership of this memory needs to be reassigned to proper
owners to allow access from the protection domain running on
DSP. This reassigning of ownership is not correct if done for
any other supported flags.

When any other flag is requested from userspace, fastrpc is
trying to reassign the ownership of memory and this reassignment
is getting skipped for remote heap request which is incorrect.
Add proper flag check to reassign the memory only if remote heap
is requested.

Fixes: 532ad70c6d44 ("misc: fastrpc: Add mmap request assigning for static PD pool")
Cc: stable <stable@kernel.org>
Tested-by: Ekansh Gupta <quic_ekangupt@quicinc.com>
Signed-off-by: Ekansh Gupta <quic_ekangupt@quicinc.com>
---
 drivers/misc/fastrpc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c
index a701132..9b88132 100644
--- a/drivers/misc/fastrpc.c
+++ b/drivers/misc/fastrpc.c
@@ -1892,7 +1892,7 @@ static int fastrpc_req_mmap(struct fastrpc_user *fl, char __user *argp)
 	req.vaddrout = rsp_msg.vaddr;
 
 	/* Add memory to static PD pool, protection thru hypervisor */
-	if (req.flags != ADSP_MMAP_REMOTE_HEAP_ADDR && fl->cctx->vmcount) {
+	if (req.flags == ADSP_MMAP_REMOTE_HEAP_ADDR && fl->cctx->vmcount) {
 		struct qcom_scm_vmperm perm;
 
 		perm.vmid = QCOM_SCM_VMID_HLOS;
-- 
2.7.4


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

* Re: [PATCH v1] misc: fastrpc: Reassign memory ownership only for remote heap
  2023-03-21 10:21 [PATCH v1] misc: fastrpc: Reassign memory ownership only for remote heap Ekansh Gupta
@ 2023-03-21 20:53 ` Srinivas Kandagatla
  2023-03-29 10:09   ` Greg KH
  2023-05-12 14:54 ` Srinivas Kandagatla
  1 sibling, 1 reply; 5+ messages in thread
From: Srinivas Kandagatla @ 2023-03-21 20:53 UTC (permalink / raw)
  To: Ekansh Gupta, linux-arm-msm
  Cc: ekangupt, gregkh, linux-kernel, bkumar, fastrpc.upstream, stable



On 21/03/2023 10:21, Ekansh Gupta wrote:
> The userspace map request for remote heap allocates CMA memory.
> The ownership of this memory needs to be reassigned to proper
> owners to allow access from the protection domain running on
> DSP. This reassigning of ownership is not correct if done for
> any other supported flags.
> 
> When any other flag is requested from userspace, fastrpc is
> trying to reassign the ownership of memory and this reassignment
> is getting skipped for remote heap request which is incorrect.
> Add proper flag check to reassign the memory only if remote heap
> is requested.
> 
> Fixes: 532ad70c6d44 ("misc: fastrpc: Add mmap request assigning for static PD pool")
> Cc: stable <stable@kernel.org>
> Tested-by: Ekansh Gupta <quic_ekangupt@quicinc.com>
> Signed-off-by: Ekansh Gupta <quic_ekangupt@quicinc.com>

Thanks for fixing this,  without this fix the code inside if condition 
was a dead code.


Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>


--srini
> ---
>   drivers/misc/fastrpc.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c
> index a701132..9b88132 100644
> --- a/drivers/misc/fastrpc.c
> +++ b/drivers/misc/fastrpc.c
> @@ -1892,7 +1892,7 @@ static int fastrpc_req_mmap(struct fastrpc_user *fl, char __user *argp)
>   	req.vaddrout = rsp_msg.vaddr;
>   
>   	/* Add memory to static PD pool, protection thru hypervisor */
> -	if (req.flags != ADSP_MMAP_REMOTE_HEAP_ADDR && fl->cctx->vmcount) {
> +	if (req.flags == ADSP_MMAP_REMOTE_HEAP_ADDR && fl->cctx->vmcount) {
>   		struct qcom_scm_vmperm perm;
>   
>   		perm.vmid = QCOM_SCM_VMID_HLOS;

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

* Re: [PATCH v1] misc: fastrpc: Reassign memory ownership only for remote heap
  2023-03-21 20:53 ` Srinivas Kandagatla
@ 2023-03-29 10:09   ` Greg KH
  2023-05-12 12:40     ` Srinivas Kandagatla
  0 siblings, 1 reply; 5+ messages in thread
From: Greg KH @ 2023-03-29 10:09 UTC (permalink / raw)
  To: Srinivas Kandagatla
  Cc: Ekansh Gupta, linux-arm-msm, ekangupt, linux-kernel, bkumar,
	fastrpc.upstream, stable

On Tue, Mar 21, 2023 at 08:53:33PM +0000, Srinivas Kandagatla wrote:
> 
> 
> On 21/03/2023 10:21, Ekansh Gupta wrote:
> > The userspace map request for remote heap allocates CMA memory.
> > The ownership of this memory needs to be reassigned to proper
> > owners to allow access from the protection domain running on
> > DSP. This reassigning of ownership is not correct if done for
> > any other supported flags.
> > 
> > When any other flag is requested from userspace, fastrpc is
> > trying to reassign the ownership of memory and this reassignment
> > is getting skipped for remote heap request which is incorrect.
> > Add proper flag check to reassign the memory only if remote heap
> > is requested.
> > 
> > Fixes: 532ad70c6d44 ("misc: fastrpc: Add mmap request assigning for static PD pool")
> > Cc: stable <stable@kernel.org>
> > Tested-by: Ekansh Gupta <quic_ekangupt@quicinc.com>
> > Signed-off-by: Ekansh Gupta <quic_ekangupt@quicinc.com>
> 
> Thanks for fixing this,  without this fix the code inside if condition was a
> dead code.
> 
> 
> Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>

Are you going to be collecting these and sending them on?  If not,
please do.

thanks,

greg k-h

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

* Re: [PATCH v1] misc: fastrpc: Reassign memory ownership only for remote heap
  2023-03-29 10:09   ` Greg KH
@ 2023-05-12 12:40     ` Srinivas Kandagatla
  0 siblings, 0 replies; 5+ messages in thread
From: Srinivas Kandagatla @ 2023-05-12 12:40 UTC (permalink / raw)
  To: Greg KH
  Cc: Ekansh Gupta, linux-arm-msm, ekangupt, linux-kernel, bkumar,
	fastrpc.upstream, stable



On 29/03/2023 11:09, Greg KH wrote:
> On Tue, Mar 21, 2023 at 08:53:33PM +0000, Srinivas Kandagatla wrote:
>>
>>
>> On 21/03/2023 10:21, Ekansh Gupta wrote:
>>> The userspace map request for remote heap allocates CMA memory.
>>> The ownership of this memory needs to be reassigned to proper
>>> owners to allow access from the protection domain running on
>>> DSP. This reassigning of ownership is not correct if done for
>>> any other supported flags.
>>>
>>> When any other flag is requested from userspace, fastrpc is
>>> trying to reassign the ownership of memory and this reassignment
>>> is getting skipped for remote heap request which is incorrect.
>>> Add proper flag check to reassign the memory only if remote heap
>>> is requested.
>>>
>>> Fixes: 532ad70c6d44 ("misc: fastrpc: Add mmap request assigning for static PD pool")
>>> Cc: stable <stable@kernel.org>
>>> Tested-by: Ekansh Gupta <quic_ekangupt@quicinc.com>
>>> Signed-off-by: Ekansh Gupta <quic_ekangupt@quicinc.com>
>>
>> Thanks for fixing this,  without this fix the code inside if condition was a
>> dead code.
>>
>>
>> Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
> 
> Are you going to be collecting these and sending them on?  If not,
> please do.
Sorry for long delay,
I will take care of collecting fastrpc patches and send it.

--srini



> 
> thanks,
> 
> greg k-h

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

* Re: [PATCH v1] misc: fastrpc: Reassign memory ownership only for remote heap
  2023-03-21 10:21 [PATCH v1] misc: fastrpc: Reassign memory ownership only for remote heap Ekansh Gupta
  2023-03-21 20:53 ` Srinivas Kandagatla
@ 2023-05-12 14:54 ` Srinivas Kandagatla
  1 sibling, 0 replies; 5+ messages in thread
From: Srinivas Kandagatla @ 2023-05-12 14:54 UTC (permalink / raw)
  To: linux-arm-msm, Ekansh Gupta
  Cc: ekangupt, gregkh, linux-kernel, bkumar, fastrpc.upstream, stable


On Tue, 21 Mar 2023 15:51:40 +0530, Ekansh Gupta wrote:
> The userspace map request for remote heap allocates CMA memory.
> The ownership of this memory needs to be reassigned to proper
> owners to allow access from the protection domain running on
> DSP. This reassigning of ownership is not correct if done for
> any other supported flags.
> 
> When any other flag is requested from userspace, fastrpc is
> trying to reassign the ownership of memory and this reassignment
> is getting skipped for remote heap request which is incorrect.
> Add proper flag check to reassign the memory only if remote heap
> is requested.
> 
> [...]

Applied, thanks!

[1/1] misc: fastrpc: Reassign memory ownership only for remote heap
      commit: 5fad4a6b2d8f05c4823a08465e584f46df798b1f

Best regards,
-- 
Srinivas Kandagatla <srinivas.kandagatla@linaro.org>


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

end of thread, other threads:[~2023-05-12 14:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-21 10:21 [PATCH v1] misc: fastrpc: Reassign memory ownership only for remote heap Ekansh Gupta
2023-03-21 20:53 ` Srinivas Kandagatla
2023-03-29 10:09   ` Greg KH
2023-05-12 12:40     ` Srinivas Kandagatla
2023-05-12 14:54 ` Srinivas Kandagatla

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).