Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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: 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>
Link: https://lore.kernel.org/r/20250110134239.123603-4-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Ekansh Gupta and committed by
Greg Kroah-Hartman
e966eae7 6ca4ea1f

+2 -2
+2 -2
drivers/misc/fastrpc.c
··· 1019 1019 (pkt_size - rlen); 1020 1020 pages[i].addr = pages[i].addr & PAGE_MASK; 1021 1021 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; 1024 1024 pages[i].size = (pg_end - pg_start + 1) * PAGE_SIZE; 1025 1025 args = args + mlen; 1026 1026 rlen -= mlen;