mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Haoran Wang <haoranwangsec@gmail.com>
To: Alexander Usyskin <alexander.usyskin@intel.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Arnd Bergmann <arnd@arndb.de>,
	linux-kernel@vger.kernel.org
Subject: [PATCH] mei: bus-fixup: fix data_size in NFC interface version request
Date: Thu, 03 Dec 2026 19:42:27 +0800	[thread overview]
Message-ID: <179629814789.16896.11637331982626645638@gmail.com> (raw)

mei_nfc_if_version() sets .data_size = 1 but sends the command with
sizeof(cmd), which excludes the flexible array member data[], so the
firmware is told to consume a payload byte that the kernel never sends.
IF_VERSION carries no payload, so set data_size to 0 to match the
actual message length, as the reply side already treats data[] as the
payload.

This was found by static analysis and the trigger is theoretical,
since the kernel never sends the declared payload byte.

Fixes: b39910c2e0ac ("mei: bus: simplify how we build nfc bus name")
Signed-off-by: Haoran Wang <haoranwangsec@gmail.com>
---
 drivers/misc/mei/bus-fixup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/misc/mei/bus-fixup.c b/drivers/misc/mei/bus-fixup.c
index bea7a47d216e..59daeddeab55 100644
--- a/drivers/misc/mei/bus-fixup.c
+++ b/drivers/misc/mei/bus-fixup.c
@@ -371,7 +371,7 @@ static int mei_nfc_if_version(struct mei_cl *cl,
 	struct mei_device *bus;
 	struct mei_nfc_cmd cmd = {
 		.command = MEI_NFC_CMD_MAINTENANCE,
-		.data_size = 1,
+		.data_size = 0,
 		.sub_command = MEI_NFC_SUBCMD_IF_VERSION,
 	};
 	struct mei_nfc_reply *reply = NULL;

             reply	other threads:[~2026-12-03 11:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03 11:42 Haoran Wang [this message]
2026-12-03 11:58 ` Usyskin, Alexander

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=179629814789.16896.11637331982626645638@gmail.com \
    --to=haoranwangsec@gmail.com \
    --cc=alexander.usyskin@intel.com \
    --cc=arnd@arndb.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.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

all inboxes | Powered by JetHome®