net: ethernet: stmmac: dwmac-socfpga: fix use-after-free on probe errors
authorJohan Hovold <johan@kernel.org>
Wed, 30 Nov 2016 14:29:49 +0000 (15:29 +0100)
committerDavid S. Miller <davem@davemloft.net>
Fri, 2 Dec 2016 15:42:45 +0000 (10:42 -0500)
commit50ac64cfc39dad2ba0d8ad553d2d87dfc738cbba
tree8de0fca290b069bc9c2dbb07b7ee34a946f131e5
parent6919756caaeaa76dc56287252fb656e3c2d9b4e1
net: ethernet: stmmac: dwmac-socfpga: fix use-after-free on probe errors

Make sure to call stmmac_dvr_remove() before returning on late probe
errors so that memory is freed, clocks are disabled, and the netdev is
deregistered before its resources go away.

Fixes: 3c201b5a84ed ("net: stmmac: socfpga: Remove re-registration of
reset controller")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c