Skip to content

Commit 8bead5c

Browse files
committed
Merge tag 'ieee802154-for-davem-2021-06-24' of git://git.kernel.org/pub/scm/linux/kernel/git/sschmidt/wpan
Stefan Schmidt says: ==================== pull-request: ieee802154 for net 2021-06-24 An update from ieee802154 for your *net* tree. This time we only have fixes for ieee802154 hwsim driver. Sparked from some syzcaller reports We got a potential crash fix from Eric Dumazet and two memory leak fixes from Dongliang Mu. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 2e7256f + 0303b30 commit 8bead5c

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

drivers/net/ieee802154/mac802154_hwsim.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ static int hwsim_del_edge_nl(struct sk_buff *msg, struct genl_info *info)
480480
struct hwsim_edge *e;
481481
u32 v0, v1;
482482

483-
if (!info->attrs[MAC802154_HWSIM_ATTR_RADIO_ID] &&
483+
if (!info->attrs[MAC802154_HWSIM_ATTR_RADIO_ID] ||
484484
!info->attrs[MAC802154_HWSIM_ATTR_RADIO_EDGE])
485485
return -EINVAL;
486486

@@ -715,15 +715,15 @@ static int hwsim_subscribe_all_others(struct hwsim_phy *phy)
715715

716716
return 0;
717717

718+
sub_fail:
719+
hwsim_edge_unsubscribe_me(phy);
718720
me_fail:
719721
rcu_read_lock();
720722
list_for_each_entry_rcu(e, &phy->edges, list) {
721723
list_del_rcu(&e->list);
722724
hwsim_free_edge(e);
723725
}
724726
rcu_read_unlock();
725-
sub_fail:
726-
hwsim_edge_unsubscribe_me(phy);
727727
return -ENOMEM;
728728
}
729729

@@ -824,12 +824,17 @@ static int hwsim_add_one(struct genl_info *info, struct device *dev,
824824
static void hwsim_del(struct hwsim_phy *phy)
825825
{
826826
struct hwsim_pib *pib;
827+
struct hwsim_edge *e;
827828

828829
hwsim_edge_unsubscribe_me(phy);
829830

830831
list_del(&phy->list);
831832

832833
rcu_read_lock();
834+
list_for_each_entry_rcu(e, &phy->edges, list) {
835+
list_del_rcu(&e->list);
836+
hwsim_free_edge(e);
837+
}
833838
pib = rcu_dereference(phy->pib);
834839
rcu_read_unlock();
835840

0 commit comments

Comments
 (0)