net/bonding: Fix potential bad memory access during bonding events

When queuing work to send the NETDEV_BONDING_INFO netdev event, it's
possible that when the work is executed, the pointer to the slave
becomes invalid. This can happen if between queuing the event and the
execution of the work, the net-device was un-ensvaled and re-enslaved.

Fix that by queuing a work with the data of the slave instead of the
slave structure.

Fixes: 69e6113343 ('net/bonding: Notify state change on slaves')
Reported-by: Nikolay Aleksandrov <nikolay@redhat.com>
Signed-off-by: Moni Shoua <monis@mellanox.com>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Esse commit está contido em:
Moni Shoua
2015-02-08 11:49:32 +02:00
commit de David S. Miller
commit 92e584fe44
2 arquivos alterados com 12 adições e 18 exclusões

Ver arquivo

@@ -152,8 +152,8 @@ struct bond_parm_tbl {
struct netdev_notify_work {
struct delayed_work work;
struct slave *slave;
struct net_device *dev;
struct netdev_bonding_info bonding_info;
};
struct slave {