projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
5fb1bee
)
net: dsa: lantiq_gswip: fix use-after-free on failed probe
author
Johan Hovold
<
[email protected]
>
Wed, 16 Jan 2019 10:23:33 +0000
(11:23 +0100)
committer
David S. Miller
<
[email protected]
>
Thu, 17 Jan 2019 20:12:19 +0000
(12:12 -0800)
Make sure to disable and deregister the switch on late probe errors to
avoid use-after-free when the device-resource-managed switch is freed.
Fixes: 14fceff4771e ("net: dsa: Add Lantiq / Intel DSA driver for vrx200")
Cc: stable <
[email protected]
> # 4.20
Cc: Hauke Mehrtens <
[email protected]
>
Signed-off-by: Johan Hovold <
[email protected]
>
Reviewed-by: Andrew Lunn <
[email protected]
>
Acked-by: Hauke Mehrtens <
[email protected]
>
Signed-off-by: David S. Miller <
[email protected]
>
drivers/net/dsa/lantiq_gswip.c
patch
|
blob
|
history
diff --git
a/drivers/net/dsa/lantiq_gswip.c
b/drivers/net/dsa/lantiq_gswip.c
index 693a67f45bef1c74a3a412a915965372ff67b479..b06c41c98de9dabcd10a855888e3376efff73914 100644
(file)
--- a/
drivers/net/dsa/lantiq_gswip.c
+++ b/
drivers/net/dsa/lantiq_gswip.c
@@
-1099,7
+1099,7
@@
static int gswip_probe(struct platform_device *pdev)
dev_err(dev, "wrong CPU port defined, HW only supports port: %i",
priv->hw_info->cpu_port);
err = -EINVAL;
- goto
mdio_bus
;
+ goto
disable_switch
;
}
platform_set_drvdata(pdev, priv);
@@
-1109,6
+1109,9
@@
static int gswip_probe(struct platform_device *pdev)
(version & GSWIP_VERSION_MOD_MASK) >> GSWIP_VERSION_MOD_SHIFT);
return 0;
+disable_switch:
+ gswip_mdio_mask(priv, GSWIP_MDIO_GLOB_ENABLE, 0, GSWIP_MDIO_GLOB);
+ dsa_unregister_switch(priv->ds);
mdio_bus:
if (mdio_np)
mdiobus_unregister(priv->ds->slave_mii_bus);