* [PATCH v2] can: usb: f81604: fix struct f81604_int_data size mismatch
@ 2026-08-24 13:18 Ji-Ze Hong via B4 Relay
2026-08-24 13:26 ` Greg Kroah-Hartman
2026-08-24 15:11 ` Marc Kleine-Budde
0 siblings, 2 replies; 4+ messages in thread
From: Ji-Ze Hong via B4 Relay @ 2026-08-24 13:18 UTC (permalink / raw)
To: Marc Kleine-Budde, Vincent Mailhol, Greg Kroah-Hartman
Cc: linux-can, linux-kernel, stable, Dynetrex, Admin,
Ji-Ze Hong (Peter Hong)
From: "Ji-Ze Hong (Peter Hong)" <peter_hong@fintek.com.tw>
The struct f81604_int_data defines 9 bytes of interrupt data:
- Byte 0: Status register (sr)
- Byte 1: Interrupt register (isrc)
- Byte 2: Interrupt enable register (ier)
- Byte 3: Arbitration lost capture (alc)
- Byte 4: Error code capture (ecc)
- Byte 5: Error warning limit register (ewlr)
- Byte 6: RX error counter (rxerr)
- Byte 7: TX error counter (txerr)
- Byte 8: Reserved (val)
The hardware sends exactly 9 bytes for the interrupt endpoint.
However, the struct was defined with __aligned(4) attribute which
caused the compiler to pad the struct to 12 bytes.
This causes a problem in f81604_read_int_callback() where the short
URB check compares urb->actual_length against sizeof(*data). When
sizeof(struct f81604_int_data) is 12 but the hardware only sends 9
bytes, the check fails and valid interrupt messages are discarded.
This results in the driver only being able to transmit once because
the TX complete interrupt is never processed.
Fix this by removing the __aligned(4) attribute so the struct size
matches the actual hardware data size of 9 bytes.
Fixes: 7299b1b39a25 ("can: usb: f81604: handle short interrupt urb messages properly")
Cc: stable@vger.kernel.org
Reported-by: Dynetrex, Admin <admin@dynetrex.com>
Closes: https://lore.kernel.org/all/A3834A07-5639-4779-844F-C5843DFC3928@dynetrex.com/
Signed-off-by: Ji-Ze Hong (Peter Hong) <peter_hong@fintek.com.tw>
---
v2:
- Added Reported-by and Remove mismatched Fixes tags
---
drivers/net/can/usb/f81604.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/can/usb/f81604.c b/drivers/net/can/usb/f81604.c
index f12318268e46..4c147b9d6d69 100644
--- a/drivers/net/can/usb/f81604.c
+++ b/drivers/net/can/usb/f81604.c
@@ -169,7 +169,7 @@ struct f81604_int_data {
u8 rxerr;
u8 txerr;
u8 val;
-} __packed __aligned(4);
+} __packed;
struct f81604_sff {
__be16 id;
---
base-commit: a13c140cc289c0b7b3770bce5b3ad42ab35074aa
change-id: 20260824-f81604-fix-aaebd1f42e06
Best regards,
--
Ji-Ze Hong (Peter Hong) <peter_hong@fintek.com.tw>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] can: usb: f81604: fix struct f81604_int_data size mismatch
2026-08-24 13:18 [PATCH v2] can: usb: f81604: fix struct f81604_int_data size mismatch Ji-Ze Hong via B4 Relay
@ 2026-08-24 13:26 ` Greg Kroah-Hartman
2026-08-24 15:11 ` Marc Kleine-Budde
1 sibling, 0 replies; 4+ messages in thread
From: Greg Kroah-Hartman @ 2026-08-24 13:26 UTC (permalink / raw)
To: peter_hong
Cc: Marc Kleine-Budde, Vincent Mailhol, linux-can, linux-kernel,
stable, Dynetrex, Admin
On Mon, Aug 24, 2026 at 09:18:14PM +0800, Ji-Ze Hong via B4 Relay wrote:
> From: "Ji-Ze Hong (Peter Hong)" <peter_hong@fintek.com.tw>
>
> The struct f81604_int_data defines 9 bytes of interrupt data:
> - Byte 0: Status register (sr)
> - Byte 1: Interrupt register (isrc)
> - Byte 2: Interrupt enable register (ier)
> - Byte 3: Arbitration lost capture (alc)
> - Byte 4: Error code capture (ecc)
> - Byte 5: Error warning limit register (ewlr)
> - Byte 6: RX error counter (rxerr)
> - Byte 7: TX error counter (txerr)
> - Byte 8: Reserved (val)
>
> The hardware sends exactly 9 bytes for the interrupt endpoint.
> However, the struct was defined with __aligned(4) attribute which
> caused the compiler to pad the struct to 12 bytes.
>
> This causes a problem in f81604_read_int_callback() where the short
> URB check compares urb->actual_length against sizeof(*data). When
> sizeof(struct f81604_int_data) is 12 but the hardware only sends 9
> bytes, the check fails and valid interrupt messages are discarded.
>
> This results in the driver only being able to transmit once because
> the TX complete interrupt is never processed.
>
> Fix this by removing the __aligned(4) attribute so the struct size
> matches the actual hardware data size of 9 bytes.
>
> Fixes: 7299b1b39a25 ("can: usb: f81604: handle short interrupt urb messages properly")
> Cc: stable@vger.kernel.org
> Reported-by: Dynetrex, Admin <admin@dynetrex.com>
> Closes: https://lore.kernel.org/all/A3834A07-5639-4779-844F-C5843DFC3928@dynetrex.com/
> Signed-off-by: Ji-Ze Hong (Peter Hong) <peter_hong@fintek.com.tw>
> ---
> v2:
> - Added Reported-by and Remove mismatched Fixes tags
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] can: usb: f81604: fix struct f81604_int_data size mismatch
2026-08-24 13:18 [PATCH v2] can: usb: f81604: fix struct f81604_int_data size mismatch Ji-Ze Hong via B4 Relay
2026-08-24 13:26 ` Greg Kroah-Hartman
@ 2026-08-24 15:11 ` Marc Kleine-Budde
2026-08-24 23:39 ` Drew Willey
1 sibling, 1 reply; 4+ messages in thread
From: Marc Kleine-Budde @ 2026-08-24 15:11 UTC (permalink / raw)
To: Ji-Ze Hong via B4 Relay
Cc: Vincent Mailhol, Greg Kroah-Hartman, linux-can, linux-kernel,
stable, Dynetrex, Admin, Ji-Ze Hong (Peter Hong)
[-- Attachment #1: Type: text/plain, Size: 1909 bytes --]
On 24.08.2026 21:18:14, Ji-Ze Hong via B4 Relay wrote:
> From: "Ji-Ze Hong (Peter Hong)" <peter_hong@fintek.com.tw>
>
> The struct f81604_int_data defines 9 bytes of interrupt data:
> - Byte 0: Status register (sr)
> - Byte 1: Interrupt register (isrc)
> - Byte 2: Interrupt enable register (ier)
> - Byte 3: Arbitration lost capture (alc)
> - Byte 4: Error code capture (ecc)
> - Byte 5: Error warning limit register (ewlr)
> - Byte 6: RX error counter (rxerr)
> - Byte 7: TX error counter (txerr)
> - Byte 8: Reserved (val)
>
> The hardware sends exactly 9 bytes for the interrupt endpoint.
> However, the struct was defined with __aligned(4) attribute which
> caused the compiler to pad the struct to 12 bytes.
>
> This causes a problem in f81604_read_int_callback() where the short
> URB check compares urb->actual_length against sizeof(*data). When
> sizeof(struct f81604_int_data) is 12 but the hardware only sends 9
> bytes, the check fails and valid interrupt messages are discarded.
>
> This results in the driver only being able to transmit once because
> the TX complete interrupt is never processed.
>
> Fix this by removing the __aligned(4) attribute so the struct size
> matches the actual hardware data size of 9 bytes.
>
> Fixes: 7299b1b39a25 ("can: usb: f81604: handle short interrupt urb messages properly")
> Cc: stable@vger.kernel.org
> Reported-by: Dynetrex, Admin <admin@dynetrex.com>
> Closes: https://lore.kernel.org/all/A3834A07-5639-4779-844F-C5843DFC3928@dynetrex.com/
> Signed-off-by: Ji-Ze Hong (Peter Hong) <peter_hong@fintek.com.tw>
Applied to linux-can.
regards,
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung Nürnberg | Phone: +49-5121-206917-129 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-9 |
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] can: usb: f81604: fix struct f81604_int_data size mismatch
2026-08-24 15:11 ` Marc Kleine-Budde
@ 2026-08-24 23:39 ` Drew Willey
0 siblings, 0 replies; 4+ messages in thread
From: Drew Willey @ 2026-08-24 23:39 UTC (permalink / raw)
To: mkl
Cc: admin, devnull+peter_hong.fintek.com.tw, gregkh, linux-can,
linux-kernel, mailhol, peter_hong, stable, Drew Willey
Tested running ChromeOS, kernel 6.12, rev facaadd, f81604 (2c42:1709), the driver hits "f81604_read_int_callback: short int URB: 9 < 12" on the first Tx attempt and stops the Tx queue. Subsequent frames queue up and are not transmitted.
Reloaded the f81604 module with this patch. Transmitted several frames over a minute and all succeed.
Tested-by: Drew Willey <dwilley@google.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-08-24 23:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-24 13:18 [PATCH v2] can: usb: f81604: fix struct f81604_int_data size mismatch Ji-Ze Hong via B4 Relay
2026-08-24 13:26 ` Greg Kroah-Hartman
2026-08-24 15:11 ` Marc Kleine-Budde
2026-08-24 23:39 ` Drew Willey
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®