hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/net/ieee802154/mac802154_hwsim.c
....@@ -522,7 +522,7 @@
522522 static int hwsim_set_edge_lqi(struct sk_buff *msg, struct genl_info *info)
523523 {
524524 struct nlattr *edge_attrs[MAC802154_HWSIM_EDGE_ATTR_MAX + 1];
525
- struct hwsim_edge_info *einfo;
525
+ struct hwsim_edge_info *einfo, *einfo_old;
526526 struct hwsim_phy *phy_v0;
527527 struct hwsim_edge *e;
528528 u32 v0, v1;
....@@ -560,8 +560,10 @@
560560 list_for_each_entry_rcu(e, &phy_v0->edges, list) {
561561 if (e->endpoint->idx == v1) {
562562 einfo->lqi = lqi;
563
- rcu_assign_pointer(e->info, einfo);
563
+ einfo_old = rcu_replace_pointer(e->info, einfo,
564
+ lockdep_is_held(&hwsim_phys_lock));
564565 rcu_read_unlock();
566
+ kfree_rcu(einfo_old, rcu);
565567 mutex_unlock(&hwsim_phys_lock);
566568 return 0;
567569 }