ieee802154: hwsim: fix missing unlock on error in hwsim_add_one()
authorWei Yongjun <weiyongjun1@huawei.com>
Wed, 8 Aug 2018 03:10:39 +0000 (03:10 +0000)
committerDavid S. Miller <davem@davemloft.net>
Thu, 9 Aug 2018 01:36:49 +0000 (18:36 -0700)
Add the missing unlock before return from function hwsim_add_one()
in the error handling case.

Fixes: f25da51fdc38 ("ieee802154: hwsim: add replacement for fakelb")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Stefan Schmidt <stefan@datenfreihafen.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ieee802154/mac802154_hwsim.c

index 9319780..07a493d 100644 (file)
@@ -817,8 +817,10 @@ static int hwsim_add_one(struct genl_info *info, struct device *dev,
        mutex_lock(&hwsim_phys_lock);
        if (init) {
                err = hwsim_subscribe_all_others(phy);
-               if (err < 0)
+               if (err < 0) {
+                       mutex_unlock(&hwsim_phys_lock);
                        goto err_reg;
+               }
        }
        list_add_tail(&phy->list, &hwsim_phys);
        mutex_unlock(&hwsim_phys_lock);