mac802154: fix destructon ordering for ieee802154 devices
authorKonstantin Khlebnikov <khlebnikov@openvz.org>
Fri, 14 Dec 2012 01:03:03 +0000 (01:03 +0000)
committerDavid S. Miller <davem@davemloft.net>
Fri, 14 Dec 2012 18:14:07 +0000 (13:14 -0500)
mutex_destroy() must be called before wpan_phy_free(), because it puts the last
reference and frees memory. Catched as overwritten poison in kmalloc-2048.

Signed-off-by: Konstantin Khlebnikov <khlebnikov@openvz.org>
Cc: Alexander Smirnov <alex.bluesman.smirnov@gmail.com>
Cc: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: linux-zigbee-devel@lists.sourceforge.net
Cc: netdev@vger.kernel.org
Signed-off-by: David S. Miller <davem@davemloft.net>
net/mac802154/ieee802154_dev.c

index e748aed..b7c7f81 100644 (file)
@@ -224,9 +224,9 @@ void ieee802154_free_device(struct ieee802154_dev *hw)
 
        BUG_ON(!list_empty(&priv->slaves));
 
-       wpan_phy_free(priv->phy);
-
        mutex_destroy(&priv->slaves_mtx);
+
+       wpan_phy_free(priv->phy);
 }
 EXPORT_SYMBOL(ieee802154_free_device);