RE: [PATCH] mei: bus-fixup: fix data_size in NFC interface version request

From: Usyskin, Alexander

Date: Thu Dec 03 2026 - 06:58:43 EST


> Subject: [PATCH] mei: bus-fixup: fix data_size in NFC interface version request
>
> 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.
>

The ancient firmware that uses this code seem to expect 1 there.
Let's do not touch this.
NACK

- -
Thanks,
Sasha


> Fixes: b39910c2e0ac ("mei: bus: simplify how we build nfc bus name")
> Signed-off-by: Haoran Wang <haoranwangsec@xxxxxxxxx>
> ---
> 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;