Re: [PATCH net] phonet: fix use-after-free in can_respond()

From: Rémi Denis-Courmont

Date: Fri Nov 27 2026 - 15:17:16 EST


Le torstaina 26. marraskuuta 2026, 0.16.27 Itä-Euroopan normaaliaika Elkin
Cruz a écrit :
> In can_respond(), ph is cached before pskb_may_pull(skb, 5). When
> ph->pn_res == PN_PREFIX and pskb_may_pull() reallocates skb->head,
> the check `if (ph->pn_res == PN_COMMGR)` dereferences the dangling ph
> pointer before the code re-acquires ph = pn_hdr(skb).
>
> Check for PN_COMMGR before calling pskb_may_pull() to avoid accessing
> the potentially invalidated header pointer.
>
> This issue was found while trying out new Clang static analysis checks for
> kernel bug classes. The finding was triaged and fixed, and this commit
> description was drafted with the help of AI, then verified by code
> inspection and compile-tested against linux-next (not reproduced and not
> runtime-tested on hardware).
>
> Fixes: c3a90c788b74 ("Phonet: do not reply to indication reset packets")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Elkin Cruz <elkin@xxxxxxxxxx>

Acked-by: Rémi Denis-Courmont <courmisch@xxxxxxxxx>

--
ヅニ-クーモン・レミ
https://www.remlab.net/