From nobody Tue Feb 10 08:27:30 2026 Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2929020E704 for ; Fri, 10 Jan 2025 13:43:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736516586; cv=none; b=SWfCSiOfbG/f6spe4gDdT8gFAgQyfuh85P5f2dhvUvcbNqUzXtNTxyTowx1KqTy3g632fqNBBHlQPpMGnuSA+jMhpEnSjUNuluBxFJkbND4z//IZMvz/DFWr/oPkYOWgaY8p7HMOL3QSUmugBQ3Gdzwose/SVmh9oevEqg0dkSE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736516586; c=relaxed/simple; bh=utEVLQxEGVvMNNK6gNpJ93BenYMQjczvtqNl4ArbmhM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=E55yMmqxRAjq4lVoQVxIWuT5krlMppfSKbk6OvfuPzwZxjPwZuF/vTvvfHfVsx9wPccYYfiEIdqCzfu25KGTBLBxrsF5MKcmHDHACPKK9PhZCIuXKa2u4XYSG3u4bayxTGha243/kx2Fd17yceELbDVetgXX33YVrtvvOMWCCMo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=sOo57NjM; arc=none smtp.client-ip=209.85.128.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="sOo57NjM" Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-4361e89b6daso15680785e9.3 for ; Fri, 10 Jan 2025 05:43:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1736516582; x=1737121382; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=a5i/6NQGSZ6KHLmzkn6T2kUio76RGyO4d08djtw8DdU=; b=sOo57NjMVehQ7DCa+SOuT2fX2+/nAdcRoiNol+KEfd/1gQIsQWNFXHLEmvb16M6TWE RwOOoEZzz4ECQQwrFVAn1Seam/m8F+PZ1z4drgjN3JHhqIXUGWAOHFS1R1qWRUZzwuL+ h1AgvJiqe25GeCk+PNUKLdiAXW19zITwco+c154u3H4yifeHZrnbZyx7F0uS47C+EZhX m0NdIZKbUMa5I7jw2GxKaTPbV7zbUX7AQqmWdjQ5M296LMCR7EilVyFULQiqlduYAJ7R O0N3/xlwCUE2MuSSVJ/pBgp6NaO52jcWZniNEswyyImRAGQvWUSclisW3erX/vQCNfpf IETA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736516582; x=1737121382; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=a5i/6NQGSZ6KHLmzkn6T2kUio76RGyO4d08djtw8DdU=; b=ImqqwTv5V6NRf3P1FYLqUSIlETSc2Bz31ot+Gzdqb8GOvUS5HkuCHky++8wUtqY/NQ lUtBlL56DABPpNVqnpljFcNzwxCxluj80CXqXdotTj1q0ySGkFJuuvBJhs5zjgyW2+Qa JKzJA8P500SctKl6pvcLIkr5+zRAfxpgYvqV1i0b7vgAHutKnLNrI8I0FSs+kYDU0gqB EUf9i8KF1wcL/DdPcsHux6xRSkJ9ftV2hXI9iHfLLgWb0+KNifYq4U34j1SLOoyz+iex SM46uFZaEMZsgCMUqgpnLgwnBrHbxv2wl33J1GkSu6ysR2bXNiWDnajTa/qLt4ys6zEF fiZg== X-Gm-Message-State: AOJu0YzDSTDUdYoWX01JW4NS2/PFUlY0KU06b2s0+hsP1RY71thyMv2X Re229VlduP2rrhjPpBdXx7T/AmzRBlQ6HD6D44hx0xHLhx9p+6VhPeG6ALN2boOpSWZJ8QzbjzC o X-Gm-Gg: ASbGnct71CORVhiE4LX0A1Yj5k5D0dnZbWdNQEi3acfU7KPgJMLt9W+KdULq/VKWPLk T6wp4n+MoYwviY5X5ft2Hwa/qydHKRCajfNmz+HJOER5fF0n1w781X49eXHlFsn5vBFMQRKiN7y Ijx8kwPWCER5A72a3vAH0dRgEshAcp2m0KA77ASmIOeavDSxyF2dtmXN2V32L18umtOqpwsS1QI cFJz5zShB2xb55U4VylFSNtp6lHW4cah20StN6WXy9Dj3as8m7UEd443v7lTXI9mhuMDSFfNx8F dUlqhQ== X-Google-Smtp-Source: AGHT+IGPgeiEg07T4HbqZC3EP5uOkvX1UohvjygcaLPvSltRf8MAStXQbBbz6AVHSSL8L2qbrrjg+Q== X-Received: by 2002:a05:600c:3505:b0:434:a7b6:10e9 with SMTP id 5b1f17b1804b1-436e26a9045mr105977975e9.17.1736516582435; Fri, 10 Jan 2025 05:43:02 -0800 (PST) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-436e2e89e14sm87584295e9.33.2025.01.10.05.43.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jan 2025 05:43:01 -0800 (PST) From: srinivas.kandagatla@linaro.org To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Ekansh Gupta , stable@kernel.org, Srinivas Kandagatla Subject: [PATCH 3/3] misc: fastrpc: Fix copy buffer page size Date: Fri, 10 Jan 2025 13:42:39 +0000 Message-Id: <20250110134239.123603-4-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250110134239.123603-1-srinivas.kandagatla@linaro.org> References: <20250110134239.123603-1-srinivas.kandagatla@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1437; i=srinivas.kandagatla@linaro.org; h=from:subject; bh=pwBonUgs7qSy4WNiJvmj7gkdSwx+j7EPshMc++fCBYQ=; b=owEBbQGS/pANAwAKAXqh/VnHNFU3AcsmYgBngSPPh3tuJPKqcN+YETPuy972rCd25yd0UZnO2 3lkmUd/myGJATMEAAEKAB0WIQQi509axvzi9vce3Y16of1ZxzRVNwUCZ4EjzwAKCRB6of1ZxzRV N5jHCAC6PJ8+yh/e2AfxiKjrlbmvF06d1NXQfwAHuKK4xm/UZxGPeHZaB/LgiQqYmy9skhgcBU0 sjipGe8R3M+KcGVxKNihMWzfoEnGLJNIK7MxBwJgV5H6LoUhGCmojxuHMM2ZS3+N9O5G6YO9/XN kh2X6oqtj/i9UVj5gCE+p7H94N4Gc0PnVyliptyCy8BkTSIvrsULY38JCrcFXIKErIHNBAJLTcn Aq2egBpQL6ocLWLUkH7z6kwZgEoiLr+bWOKDQ8pGNERl7KihphAQDk6VBB0iABZmwjItL5yDml6 Sbq7QmHdAoBRs9Ul7o6pkbkjBILMrZmeWZtlWHMUa/ctDpuZ X-Developer-Key: i=srinivas.kandagatla@linaro.org; a=openpgp; fpr=ED6472765AB36EC43B3EF97AD77E3FC0562560D6 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Ekansh Gupta 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 Signed-off-by: Srinivas Kandagatla --- 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 891529aa9069..e567a36275af 100644 --- a/drivers/misc/fastrpc.c +++ b/drivers/misc/fastrpc.c @@ -1019,8 +1019,8 @@ static int fastrpc_get_args(u32 kernel, struct fastrp= c_invoke_ctx *ctx) (pkt_size - rlen); pages[i].addr =3D pages[i].addr & PAGE_MASK; =20 - pg_start =3D (args & PAGE_MASK) >> PAGE_SHIFT; - pg_end =3D ((args + len - 1) & PAGE_MASK) >> PAGE_SHIFT; + pg_start =3D (rpra[i].buf.pv & PAGE_MASK) >> PAGE_SHIFT; + pg_end =3D ((rpra[i].buf.pv + len - 1) & PAGE_MASK) >> PAGE_SHIFT; pages[i].size =3D (pg_end - pg_start + 1) * PAGE_SIZE; args =3D args + mlen; rlen -=3D mlen; --=20 2.25.1