LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thorsten Blum <blum@kernel.org>
To: Madhavan Srinivasan <maddy@linux.ibm.com>,
	Michael Ellerman <mpe@ellerman.id.au>,
	Nicholas Piggin <npiggin@gmail.com>,
	"Christophe Leroy (CS GROUP)" <chleroy@kernel.org>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Paul Mackerras <paulus@ozlabs.org>
Cc: Thorsten Blum <blum@kernel.org>, linuxppc-dev@lists.ozlabs.org
Subject: [PATCH] macintosh/windfarm: Fix fan ID bounds check in smu_set_fan()
Date: Wed, 25 Nov 2026 11:57:35 +0100	[thread overview]
Message-ID: <20261125105737.273342-2-blum@kernel.org> (raw)

The 14-byte legacy fan payload contains 2 control bytes followed by 6
16-bit fan values. However, the existing check also accepts IDs 6 and 7.

ID 6 stores its value in the last 2 bytes of the buffer, but outside the
transmitted payload, while ID 7 writes beyond the 16-byte buffer.

Reject IDs greater than 5 for legacy fan commands.

Fixes: 75722d3992f5 ("[PATCH] ppc64: Thermal control for SMU based machines")
Signed-off-by: Thorsten Blum <blum@kernel.org>
---
 drivers/macintosh/windfarm_smu_controls.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/macintosh/windfarm_smu_controls.c b/drivers/macintosh/windfarm_smu_controls.c
index 9adceae74345..f430f160f246 100644
--- a/drivers/macintosh/windfarm_smu_controls.c
+++ b/drivers/macintosh/windfarm_smu_controls.c
@@ -74,7 +74,7 @@ static int smu_set_fan(int pwm, u8 id, u16 value)
 		*((u16 *)(&buffer[2])) = value;
 		cmd.data_len = 4;
 	} else {
-		if (id > 7)
+		if (id > 5)
 			return -EINVAL;
 		/* Fill argument buffer */
 		memset(buffer, 0, 16);


                 reply	other threads:[~2026-11-25 10:58 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20261125105737.273342-2-blum@kernel.org \
    --to=blum@kernel.org \
    --cc=benh@kernel.crashing.org \
    --cc=chleroy@kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=maddy@linux.ibm.com \
    --cc=mpe@ellerman.id.au \
    --cc=npiggin@gmail.com \
    --cc=paulus@ozlabs.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