Re: [PATCH net-next] net: dsa: Fix use after free in dsa_switch_remove()

From: Vivien Didelot
Date: Sat Nov 02 2019 - 23:54:00 EST


On Sat, 2 Nov 2019 20:13:26 -0700, Florian Fainelli <f.fainelli@xxxxxxxxx> wrote:
> The order in which the ports are deleted from the list and freed and the
> call to dsa_tree_remove_switch() is done is reversed, which leads to an

s/dsa_tree_remove_switch/dsa_switch_remove/

> use after free condition. Reverse the two: first tear down the ports and
> switch from the fabric, then free the ports associated with that switch
> fabric.
>
> Fixes: 05f294a85235 ("net: dsa: allocate ports on touch")
> Signed-off-by: Florian Fainelli <f.fainelli@xxxxxxxxx>

Thanks for reporting and fixing this!

Reviewed-by: Vivien Didelot <vivien.didelot@xxxxxxxxx>