Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Laxman Acharya Padhya <acharyalaxman8848@gmail.com>
To: Sven Peter <sven@kernel.org>, Janne Grunau <j@jannau.net>
Cc: Neal Gompa <neal@gompa.dev>, Arnd Bergmann <arnd@arndb.de>,
	asahi@lists.linux.dev, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: [PATCH v2 3/4] soc: apple: rtkit: reject syslog indices outside the entry count
Date: Mon, 24 Aug 2026 14:11:39 +0545	[thread overview]
Message-ID: <930eb129c35cdffb877b8fd16662a3250a0e2ecf.1787559303.git.acharyalaxman8848@gmail.com> (raw)
In-Reply-To: <cover.1787559303.git.acharyalaxman8848@gmail.com>

syslog_n_entries is a count, so valid indices range from zero through
syslog_n_entries - 1. The current check also accepts syslog_n_entries
itself.

Reject that index before deriving the shared-buffer offset. The shared
copy bounds check remains the final protection against inconsistent
firmware-provided layouts.

Fixes: 9bd1d9a0d8bb ("soc: apple: Add RTKit IPC library")
Cc: stable@vger.kernel.org
Signed-off-by: Laxman Acharya Padhya <acharyalaxman8848@gmail.com>
---
 drivers/soc/apple/rtkit.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/soc/apple/rtkit.c b/drivers/soc/apple/rtkit.c
index 2e62f9b3c948..da766df5a6d7 100644
--- a/drivers/soc/apple/rtkit.c
+++ b/drivers/soc/apple/rtkit.c
@@ -481,7 +481,7 @@ static void apple_rtkit_syslog_rx_log(struct apple_rtkit *rtk, u64 msg)
 			"RTKit: received syslog message but no syslog_buffer.buffer or syslog_buffer.iomem\n");
 		goto done;
 	}
-	if (idx > rtk->syslog_n_entries) {
+	if (idx >= rtk->syslog_n_entries) {
 		dev_warn(rtk->dev, "RTKit: syslog index %d out of range\n",
 			 idx);
 		goto done;
-- 
2.51.2



  parent reply	other threads:[~2026-08-24  8:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-24  8:26 [PATCH v2 0/4] soc: apple: rtkit: harden syslog shared-buffer handling Laxman Acharya Padhya
2026-08-24  8:26 ` [PATCH v2 1/4] soc: apple: rtkit: free syslog buffer before reinitializing Laxman Acharya Padhya
2026-08-24  8:26 ` [PATCH v2 2/4] soc: apple: rtkit: bound syslog copies to the shared buffer Laxman Acharya Padhya
2026-08-24  8:26 ` Laxman Acharya Padhya [this message]
2026-08-24  8:26 ` [PATCH v2 4/4] soc: apple: rtkit: rate limit malformed syslog warnings Laxman Acharya Padhya
2026-08-24  8:55 ` [PATCH v2 0/4] soc: apple: rtkit: harden syslog shared-buffer handling Sven Peter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=930eb129c35cdffb877b8fd16662a3250a0e2ecf.1787559303.git.acharyalaxman8848@gmail.com \
    --to=acharyalaxman8848@gmail.com \
    --cc=arnd@arndb.de \
    --cc=asahi@lists.linux.dev \
    --cc=j@jannau.net \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=neal@gompa.dev \
    --cc=stable@vger.kernel.org \
    --cc=sven@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox