[PATCH v2] usb: appledisplay: validate interrupt report length
From: Pengpeng Hou
Date: Wed Dec 02 2026 - 22:39:59 EST
A successful interrupt completion does not guarantee that both bytes of
the report were transferred. Resubmit a short URB without interpreting
the buffer as a button event.
Fixes: 069e8a65cd79 ("[PATCH] Driver for Apple Cinema Display")
Signed-off-by: Pengpeng Hou <pengpeng@xxxxxxxxxxx>
---
Changes since v1:
Check the actual length before the success comment, as Greg suggested.
Previous version: https://lore.kernel.org/r/20260830142410.37791-1-pengpeng@xxxxxxxxxxx
Codex assisted with patch preparation and the changelog.
Current review: Codex (Assisted-by: gpt 5).
Static review only; this revision was not built.
drivers/usb/misc/appledisplay.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/usb/misc/appledisplay.c b/drivers/usb/misc/appledisplay.c
index 16883592f7fc698ae1ca127bfd52204100e7ed97..ed7148d9a22dd9927d72aee12b3e293373e66a93 100644
--- a/drivers/usb/misc/appledisplay.c
+++ b/drivers/usb/misc/appledisplay.c
@@ -81,6 +81,8 @@ static void appledisplay_complete(struct urb *urb)
switch (status) {
case 0:
+ if (urb->actual_length < ACD_URB_BUFFER_LEN)
+ goto exit;
/* success */
break;
case -EOVERFLOW:
base-commit: 693c2e04e3f1d4c59af236e1211b7b8cb165a790