summaryrefslogtreecommitdiff
path: root/drivers/misc
diff options
context:
space:
mode:
authorEkansh Gupta <quic_ekangupt@quicinc.com>2025-01-10 16:42:39 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-02-17 11:40:39 +0300
commitc0464bad0e85fcd5d47e4297d1e410097c979e55 (patch)
tree99966f96ccf84b3d6a404c5c5a51e2790e342636 /drivers/misc
parente563ccd6be3c921db76a0868ddf021f2ae486c84 (diff)
downloadlinux-c0464bad0e85fcd5d47e4297d1e410097c979e55.tar.xz
misc: fastrpc: Fix copy buffer page size
commit e966eae72762ecfdbdb82627e2cda48845b9dd66 upstream. 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>
Diffstat (limited to 'drivers/misc')
-rw-r--r--drivers/misc/fastrpc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c
index a4c9184d31ff..fc021e265edc 100644
--- a/drivers/misc/fastrpc.c
+++ b/drivers/misc/fastrpc.c
@@ -1015,8 +1015,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;