cpmac: use after free
authorDan Carpenter <error27@gmail.com>
Tue, 2 Mar 2010 22:46:10 +0000 (22:46 +0000)
committerDavid S. Miller <davem@davemloft.net>
Wed, 3 Mar 2010 09:04:37 +0000 (01:04 -0800)
The original code dereferenced "cpmac_mii" after calling
"mdiobus_free(cpmac_mii);"

Signed-off-by: Dan Carpenter <error27@gmail.com>
Reviewed-by: Jiri Pirko <jpirko@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/cpmac.c

index b85c81f60d10639f106eed5762713b76b54e6460..9d489421535e814d8294a3cbbf079203f424f28d 100644 (file)
@@ -1290,8 +1290,8 @@ void __devexit cpmac_exit(void)
 {
        platform_driver_unregister(&cpmac_driver);
        mdiobus_unregister(cpmac_mii);
-       mdiobus_free(cpmac_mii);
        iounmap(cpmac_mii->priv);
+       mdiobus_free(cpmac_mii);
 }
 
 module_init(cpmac_init);