Skip to content

Commit a6f2f15

Browse files
Ekansh Guptagregkh
authored andcommitted
misc: fastrpc: Fix ownership reassignment of remote heap
Audio PD daemon will allocate memory for audio PD dynamic loading usage when it is attaching for the first time to audio PD. As part of this, the memory ownership is moved to the VM where audio PD can use it. In case daemon process is killed without any impact to DSP audio PD, the daemon process will retry to attach to audio PD and in this case memory won't be reallocated. If the invoke fails due to any reason, as part of err_invoke, the memory ownership is getting reassigned to HLOS even when the memory was not allocated. At this time the audio PD might still be using the memory and an attemp of ownership reassignment would result in memory issue. Fixes: 0871561 ("misc: fastrpc: Add support for audiopd") Cc: stable <stable@kernel.org> Signed-off-by: Ekansh Gupta <quic_ekangupt@quicinc.com> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Link: https://lore.kernel.org/r/20240628114501.14310-6-srinivas.kandagatla@linaro.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent ad0bd97 commit a6f2f15

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/misc/fastrpc.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1238,6 +1238,7 @@ static int fastrpc_init_create_static_process(struct fastrpc_user *fl,
12381238
struct fastrpc_phy_page pages[1];
12391239
char *name;
12401240
int err;
1241+
bool scm_done = false;
12411242
struct {
12421243
int pgid;
12431244
u32 namelen;
@@ -1289,6 +1290,7 @@ static int fastrpc_init_create_static_process(struct fastrpc_user *fl,
12891290
fl->cctx->remote_heap->phys, fl->cctx->remote_heap->size, err);
12901291
goto err_map;
12911292
}
1293+
scm_done = true;
12921294
}
12931295
}
12941296

@@ -1324,7 +1326,7 @@ static int fastrpc_init_create_static_process(struct fastrpc_user *fl,
13241326

13251327
return 0;
13261328
err_invoke:
1327-
if (fl->cctx->vmcount) {
1329+
if (fl->cctx->vmcount && scm_done) {
13281330
u64 src_perms = 0;
13291331
struct qcom_scm_vmperm dst_perms;
13301332
u32 i;

0 commit comments

Comments
 (0)