Skip to content

Commit e966eae

Browse files
ekanshibugregkh
authored andcommitted
misc: fastrpc: Fix copy buffer page size
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: 02b45b4 ("misc: fastrpc: fix remote page size calculation") Cc: [email protected] Signed-off-by: Ekansh Gupta <[email protected]> Signed-off-by: Srinivas Kandagatla <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 6ca4ea1 commit e966eae

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/misc/fastrpc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1019,8 +1019,8 @@ static int fastrpc_get_args(u32 kernel, struct fastrpc_invoke_ctx *ctx)
10191019
(pkt_size - rlen);
10201020
pages[i].addr = pages[i].addr & PAGE_MASK;
10211021

1022-
pg_start = (args & PAGE_MASK) >> PAGE_SHIFT;
1023-
pg_end = ((args + len - 1) & PAGE_MASK) >> PAGE_SHIFT;
1022+
pg_start = (rpra[i].buf.pv & PAGE_MASK) >> PAGE_SHIFT;
1023+
pg_end = ((rpra[i].buf.pv + len - 1) & PAGE_MASK) >> PAGE_SHIFT;
10241024
pages[i].size = (pg_end - pg_start + 1) * PAGE_SIZE;
10251025
args = args + mlen;
10261026
rlen -= mlen;

0 commit comments

Comments
 (0)