[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <f47spqrlkrwotgt3ibu6rn6bt4lfkrblh37yubrvsbeo6j7svl@44amfzlpor62>
Date: Wed, 18 Dec 2024 13:14:50 +0200
From: Dmitry Baryshkov <dmitry.baryshkov@...aro.org>
To: Ekansh Gupta <quic_ekangupt@...cinc.com>
Cc: srinivas.kandagatla@...aro.org, linux-arm-msm@...r.kernel.org,
gregkh@...uxfoundation.org, quic_bkumar@...cinc.com, linux-kernel@...r.kernel.org,
quic_chennak@...cinc.com, dri-devel@...ts.freedesktop.org, arnd@...db.de,
stable <stable@...nel.org>
Subject: Re: [PATCH v1 2/2] misc: fastrpc: Fix copy buffer page size
On Wed, Dec 18, 2024 at 03:54:29PM +0530, Ekansh Gupta wrote:
> 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.
Which offset?
>
> Fixes: 02b45b47fbe8 ("misc: fastrpc: fix remote page size calculation")
> Cc: stable <stable@...nel.org>
> Signed-off-by: Ekansh Gupta <quic_ekangupt@...cinc.com>
> ---
> drivers/misc/fastrpc.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c
> index cfa1546c9e3f..00154c888c45 100644
> --- a/drivers/misc/fastrpc.c
> +++ b/drivers/misc/fastrpc.c
> @@ -1019,8 +1019,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;
> --
> 2.34.1
>
--
With best wishes
Dmitry
Powered by blists - more mailing lists