Re: [PATCH v2] can: usb: f81604: fix struct f81604_int_data size mismatch
Marc Kleine-Budde <[email protected]>
| Newsgroups | org.kernel.vger.stable,org.kernel.vger.linux-can,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
On 24.08.2026 21:18:14, Ji-Ze Hong via B4 Relay wrote: > From: "Ji-Ze Hong (Peter Hong)" <[email protected]> > > 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: [email protected] > Reported-by: Dynetrex, Admin <[email protected]> > Closes: https://lore.kernel.org/all/[email protected]/ > Signed-off-by: Ji-Ze Hong (Peter Hong) <[email protected]> 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 |
signature.asc
(application/pgp-signature, 228 B)
-----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQSl+MghEFFAdY3pYJLMOmT6rpmt0gUCaoxfPQAKCRDMOmT6rpmt 0hmXAP91xu9xxDOYrO8cHst+E5lzaoro3Ss9f94pRx5LgQ4RWgEA4UX6dWR7uhJs akVJhD6uAWYnkgtbM5vxPGxh4I5kJQU= =PjPm -----END PGP SIGNATURE-----