Re: [PATCH v5 4/5] misc: fastrpc: Allocate entire reserved memory for Audio PD in probe
From: Jianping Li
Date: Mon May 25 2026 - 05:45:16 EST
On 5/25/2026 4:32 PM, Dmitry Baryshkov wrote:
On Fri, May 22, 2026 at 03:47:31PM +0800, Jianping Li wrote:
On 5/15/2026 9:38 PM, Dmitry Baryshkov wrote:The tag, cc:stable, clear description as the bugfix? How would anybody
On Fri, May 15, 2026 at 08:42:16PM +0800, Jianping Li wrote:Yes, this is a bug fix.
Allocating and freeing Audio PD memory from userspace is unsafe becauseSo, is this a bugfix or not? Is it possible to make the kernel misbehave
the kernel cannot reliably determine when the DSP has finished using the
memory. Userspace may free buffers while they are still in use by the DSP,
and remote free requests cannot be safely trusted.
Allocate the entire Audio PD reserved-memory region upfront during rpmsg
probe and tie its lifetime to the rpmsg channel. This avoids userspace-
controlled alloc/free and ensures memory is reclaimed only when the DSP
shuts down.
without this patch being applied?
guess if the patch is to be backported to earlier kernels or not?
When userspace repeatedly grows the heap, the kernel does not
support shrinking it, leading to unbounded memory usage.
This can eventually cause memory leak.
I will mention this point in the commit message.
Thanks,
Jianping.
Because currently after the audio PD requests to grow the heap,
the current kernel does not support shrinking the heap, which will all cause memory leaks.
The current modification is to allocate in advance and release uniformly, which will avoid this error.
Thanks,
Jianping.
Signed-off-by: Jianping Li <jianping.li@xxxxxxxxxxxxxxxx>
---
drivers/misc/fastrpc.c | 107 +++++++++++++++++++----------------------
1 file changed, 49 insertions(+), 58 deletions(-)