Re: [PATCH] HID: magicmouse: prevent unbounded recursion in magicmouse_raw_event()
From: Alec Hall
Date: Wed Jul 15 2026 - 19:07:05 EST
On Tue, Jul 14, 2026, Jose Villaseñor Montfort wrote:
> A double report only ever wraps two normal reports; it is never
> legitimately nested. Refuse to re-enter the DOUBLE_REPORT_ID case from a
> recursive call so the recursion depth is bounded to two [...]
Reviewed the logic: gating re-entry into the DOUBLE_REPORT_ID case on the
new "nested" flag caps recursion at two levels, and since a legitimate
double only ever wraps two non-double reports, valid traffic parses
exactly as before. The guard placement (before the size checks and the
split) and the wrapper preserving the callback signature both look right.
I also stacked this on top of the pending Magic Keyboard/Trackpad battery
series and ran it on a Magic Trackpad 2 over Bluetooth: normal pointer plus
multi-finger gestures (which drive the DOUBLE_REPORT_ID path), and battery
reporting, all keep working with no regressions or splats in dmesg.
Reviewed-by: Alec Hall <signshop.alec@xxxxxxxxx>
Tested-by: Alec Hall <signshop.alec@xxxxxxxxx>