Re: [PATCH] Input: penmount: bound packet buffer indices in IRQ path
From: Pengpeng Hou
Date: Mon Mar 23 2026 - 22:30:08 EST
Hi Andy,
This was found during static code analysis of the packet receive path.
About the fix: my reasoning was that once pm->idx has already moved past
the valid packet buffer state, the current partial packet is no longer
usable, so the safest local recovery is to drop that stale state and
resynchronize from the current byte. That is why I reset the index before
storing the next byte.
I did not choose to ignore the IRQ entirely because the interrupt has
already delivered a byte, and simply returning without resetting the stale
state would leave the parser in the same invalid condition for the next
interrupt. Resetting the index seemed like the smallest change that both
prevents the out-of-bounds write and lets the parser recover cleanly.
Thanks,
Pengpeng