* [PATCH 0/3] fastrpc: fixes for 6.13
@ 2025-01-10 13:42 srinivas.kandagatla
2025-01-10 13:42 ` [PATCH 1/3] misc: fastrpc: Deregister device nodes properly in error scenarios srinivas.kandagatla
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: srinivas.kandagatla @ 2025-01-10 13:42 UTC (permalink / raw)
To: gregkh; +Cc: linux-kernel, Srinivas Kandagatla
From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Hi Greg,
Here are few fastrpc fixes for 6.13, Could you queue
these as 6.13 material.
Patches include:
- fix error path in probe
- address fix issues around corner cases where the buffers are not
aligned to page sizes.
thanks,
Srini
Anandu Krishnan E (1):
misc: fastrpc: Deregister device nodes properly in error scenarios
Ekansh Gupta (2):
misc: fastrpc: Fix registered buffer page address
misc: fastrpc: Fix copy buffer page size
drivers/misc/fastrpc.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
--
2.25.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/3] misc: fastrpc: Deregister device nodes properly in error scenarios
2025-01-10 13:42 [PATCH 0/3] fastrpc: fixes for 6.13 srinivas.kandagatla
@ 2025-01-10 13:42 ` srinivas.kandagatla
2025-01-10 13:42 ` [PATCH 2/3] misc: fastrpc: Fix registered buffer page address srinivas.kandagatla
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: srinivas.kandagatla @ 2025-01-10 13:42 UTC (permalink / raw)
To: gregkh; +Cc: linux-kernel, Anandu Krishnan E, stable, Srinivas Kandagatla
From: Anandu Krishnan E <quic_anane@quicinc.com>
During fastrpc_rpmsg_probe, if secure device node registration
succeeds but non-secure device node registration fails, the secure
device node deregister is not called during error cleanup. Add proper
exit paths to ensure proper cleanup in case of error.
Fixes: 3abe3ab3cdab ("misc: fastrpc: add secure domain support")
Cc: stable@kernel.org
Signed-off-by: Anandu Krishnan E <quic_anane@quicinc.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
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 74181b8c386b..4a971e15d842 100644
--- a/drivers/misc/fastrpc.c
+++ b/drivers/misc/fastrpc.c
@@ -2344,7 +2344,7 @@ static int fastrpc_rpmsg_probe(struct rpmsg_device *rpdev)
err = fastrpc_device_register(rdev, data, false, domains[domain_id]);
if (err)
- goto fdev_error;
+ goto populate_error;
break;
default:
err = -EINVAL;
--
2.25.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/3] misc: fastrpc: Fix registered buffer page address
2025-01-10 13:42 [PATCH 0/3] fastrpc: fixes for 6.13 srinivas.kandagatla
2025-01-10 13:42 ` [PATCH 1/3] misc: fastrpc: Deregister device nodes properly in error scenarios srinivas.kandagatla
@ 2025-01-10 13:42 ` srinivas.kandagatla
2025-01-10 13:42 ` [PATCH 3/3] misc: fastrpc: Fix copy buffer page size srinivas.kandagatla
2025-01-10 15:15 ` [PATCH 0/3] fastrpc: fixes for 6.13 Greg KH
3 siblings, 0 replies; 5+ messages in thread
From: srinivas.kandagatla @ 2025-01-10 13:42 UTC (permalink / raw)
To: gregkh; +Cc: linux-kernel, Ekansh Gupta, stable, Srinivas Kandagatla
From: Ekansh Gupta <quic_ekangupt@quicinc.com>
For registered buffers, fastrpc driver sends the buffer information
to remote subsystem. There is a problem with current implementation
where the page address is being sent with an offset leading to
improper buffer address on DSP. This is leads to functional failures
as DSP expects base address in page information and extracts offset
information from remote arguments. Mask the offset and pass the base
page address to DSP.
This issue is observed is a corner case when some buffer which is registered
with fastrpc framework is passed with some offset by user and then the DSP
implementation tried to read the data. As DSP expects base address and takes
care of offsetting with remote arguments, passing an offsetted address will
result in some unexpected data read in DSP.
All generic usecases usually pass the buffer as it is hence is problem is
not usually observed. If someone tries to pass offsetted buffer and then
tries to compare data at HLOS and DSP end, then the ambiguity will be observed.
Fixes: 80f3afd72bd4 ("misc: fastrpc: consider address offset before sending to DSP")
Cc: stable@kernel.org
Signed-off-by: Ekansh Gupta <quic_ekangupt@quicinc.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
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 4a971e15d842..891529aa9069 100644
--- a/drivers/misc/fastrpc.c
+++ b/drivers/misc/fastrpc.c
@@ -992,7 +992,7 @@ static int fastrpc_get_args(u32 kernel, struct fastrpc_invoke_ctx *ctx)
mmap_read_lock(current->mm);
vma = find_vma(current->mm, ctx->args[i].ptr);
if (vma)
- pages[i].addr += ctx->args[i].ptr -
+ pages[i].addr += (ctx->args[i].ptr & PAGE_MASK) -
vma->vm_start;
mmap_read_unlock(current->mm);
--
2.25.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/3] misc: fastrpc: Fix copy buffer page size
2025-01-10 13:42 [PATCH 0/3] fastrpc: fixes for 6.13 srinivas.kandagatla
2025-01-10 13:42 ` [PATCH 1/3] misc: fastrpc: Deregister device nodes properly in error scenarios srinivas.kandagatla
2025-01-10 13:42 ` [PATCH 2/3] misc: fastrpc: Fix registered buffer page address srinivas.kandagatla
@ 2025-01-10 13:42 ` srinivas.kandagatla
2025-01-10 15:15 ` [PATCH 0/3] fastrpc: fixes for 6.13 Greg KH
3 siblings, 0 replies; 5+ messages in thread
From: srinivas.kandagatla @ 2025-01-10 13:42 UTC (permalink / raw)
To: gregkh; +Cc: linux-kernel, Ekansh Gupta, stable, Srinivas Kandagatla
From: Ekansh Gupta <quic_ekangupt@quicinc.com>
For non-registered buffer, fastrpc driver copies the buffer and
pass it to the remote subsystem. There is a problem with current
implementation of page size calculation which is not considering
the offset in the calculation. This might lead to passing of
improper and out-of-bounds page size which could result in
memory issue. Calculate page start and page end using the offset
adjusted address instead of absolute address.
Fixes: 02b45b47fbe8 ("misc: fastrpc: fix remote page size calculation")
Cc: stable@kernel.org
Signed-off-by: Ekansh Gupta <quic_ekangupt@quicinc.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
drivers/misc/fastrpc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c
index 891529aa9069..e567a36275af 100644
--- a/drivers/misc/fastrpc.c
+++ b/drivers/misc/fastrpc.c
@@ -1019,8 +1019,8 @@ static int fastrpc_get_args(u32 kernel, struct fastrpc_invoke_ctx *ctx)
(pkt_size - rlen);
pages[i].addr = pages[i].addr & PAGE_MASK;
- pg_start = (args & PAGE_MASK) >> PAGE_SHIFT;
- pg_end = ((args + len - 1) & PAGE_MASK) >> PAGE_SHIFT;
+ pg_start = (rpra[i].buf.pv & PAGE_MASK) >> PAGE_SHIFT;
+ pg_end = ((rpra[i].buf.pv + len - 1) & PAGE_MASK) >> PAGE_SHIFT;
pages[i].size = (pg_end - pg_start + 1) * PAGE_SIZE;
args = args + mlen;
rlen -= mlen;
--
2.25.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 0/3] fastrpc: fixes for 6.13
2025-01-10 13:42 [PATCH 0/3] fastrpc: fixes for 6.13 srinivas.kandagatla
` (2 preceding siblings ...)
2025-01-10 13:42 ` [PATCH 3/3] misc: fastrpc: Fix copy buffer page size srinivas.kandagatla
@ 2025-01-10 15:15 ` Greg KH
3 siblings, 0 replies; 5+ messages in thread
From: Greg KH @ 2025-01-10 15:15 UTC (permalink / raw)
To: srinivas.kandagatla; +Cc: linux-kernel
On Fri, Jan 10, 2025 at 01:42:36PM +0000, srinivas.kandagatla@linaro.org wrote:
> From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
>
> Hi Greg,
>
> Here are few fastrpc fixes for 6.13, Could you queue
> these as 6.13 material.
As it's a bit too late for 6.13-final (I'm going to send my last pull
request to Linus tomorrow), and these are all "fixing" old issues, I'll
just queue them up for 6.14-rc1, thanks.
greg k-h
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-01-10 15:15 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-10 13:42 [PATCH 0/3] fastrpc: fixes for 6.13 srinivas.kandagatla
2025-01-10 13:42 ` [PATCH 1/3] misc: fastrpc: Deregister device nodes properly in error scenarios srinivas.kandagatla
2025-01-10 13:42 ` [PATCH 2/3] misc: fastrpc: Fix registered buffer page address srinivas.kandagatla
2025-01-10 13:42 ` [PATCH 3/3] misc: fastrpc: Fix copy buffer page size srinivas.kandagatla
2025-01-10 15:15 ` [PATCH 0/3] fastrpc: fixes for 6.13 Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox