#include <linux/module.h>
#include <linux/timer.h>
#include <linux/platform_device.h>
+#include <linux/rtnetlink.h>
#include <linux/netdevice.h>
#include <linux/device.h>
#include <linux/spinlock.h>
pib->page = page;
pib->channel = channel;
- pib_old = phy->pib;
+ pib_old = rtnl_dereference(phy->pib);
rcu_assign_pointer(phy->pib, pib);
kfree_rcu(pib_old, rcu);
return 0;
}
einfo->lqi = 0xff;
- e->info = einfo;
+ rcu_assign_pointer(e->info, einfo);
e->endpoint = endpoint;
return e;
static void hwsim_free_edge(struct hwsim_edge *e)
{
- kfree_rcu(e->info, rcu);
+ struct hwsim_edge_info *einfo;
+
+ rcu_read_lock();
+ einfo = rcu_dereference(e->info);
+ rcu_read_unlock();
+
+ kfree_rcu(einfo, rcu);
kfree_rcu(e, rcu);
}
goto err_pib;
}
- phy->pib = pib;
+ rcu_assign_pointer(phy->pib, pib);
phy->idx = idx;
INIT_LIST_HEAD(&phy->edges);
static void hwsim_del(struct hwsim_phy *phy)
{
+ struct hwsim_pib *pib;
+
hwsim_edge_unsubscribe_me(phy);
list_del(&phy->list);
- kfree_rcu(phy->pib, rcu);
+
+ rcu_read_lock();
+ pib = rcu_dereference(phy->pib);
+ rcu_read_unlock();
+
+ kfree_rcu(pib, rcu);
ieee802154_unregister_hw(phy->hw);
ieee802154_free_hw(phy->hw);