Re: [PATCH net] net: hsr: prevent NULL pointer dereference in hsr_proxy_announce()

From: Simon Horman
Date: Mon Sep 09 2024 - 04:40:46 EST


On Sun, Sep 08, 2024 at 04:03:41AM +0900, Jeongjun Park wrote:
> In the function hsr_proxy_annouance() added in the previous commit
> 5f703ce5c981 ("net: hsr: Send supervisory frames to HSR network
> with ProxyNodeTable data"), the return value of the hsr_port_get_hsr()
> function is not checked to be a NULL pointer, which causes a NULL
> pointer dereference.
>
> To solve this, we need to add code to check whether the return value
> of hsr_port_get_hsr() is NULL.
>
> Reported-by: syzbot+02a42d9b1bd395cbcab4@xxxxxxxxxxxxxxxxxxxxxxxxx
> Fixes: 5f703ce5c981 ("net: hsr: Send supervisory frames to HSR network with ProxyNodeTable data")
> Signed-off-by: Jeongjun Park <aha310510@xxxxxxxxx>

Thanks,

I agree with your analysis; that the cited commit introduced this problem;
and that this is an appropriate solution.

Reviewed-by: Simon Horman <horms@xxxxxxxxxx>