Microchip-Ethernet / EVB-KSZ9477

Repository for using Microchip EVB-KSZ9477 board. Product Supported: KSZ9477, KSZ9567, KSZ9897, KSZ9896, KSZ8567, KSZ8565, KSZ9893, KSZ9563, KSZ8563, LAN9646, Phys(KSZ9031/9131, LAN8770
76 stars 78 forks source link

ksz_mii_exit() crash when driver unloaded #15

Open mads-bn opened 5 years ago

mads-bn commented 5 years ago

Please remove the below call to kfree - or driver crash when unloaded.

@@ -17363,7 +17369,8 @@ static void ksz_mii_exit(struct sw_priv *ks)
                        port = &ks->ports[i];
                        flush_work(&port->link_update);
-                       kfree(phydev->priv);
+                       // priv part of larger allocation and kfree will crash
+                       // kfree(phydev->priv);
                }
        }

unload/load can be tested with these commands (here using i2c bus#1@0x5f):

echo 1-005f > /sys/bus/i2c/drivers/ksz9897/unbind
echo 1-005f > /sys/bus/i2c/drivers/ksz9897/bind

https://github.com/Microchip-Ethernet/EVB-KSZ9477/blob/d7129fdf2b582ff7e25c63e458cc60dd4739226f/KSZ/linux-drivers/ksz9897/linux-4.14/drivers/net/ethernet/micrel/ksz_sw_9897.c#L17366