summary refs log tree commit diff
path: root/drivers/net/ieee802154
diff options
context:
space:
mode:
authorWei Yongjun <weiyongjun1@huawei.com>2018-08-08 03:10:39 +0000
committerDavid S. Miller <davem@davemloft.net>2018-08-08 18:36:49 -0700
commit13403d6952a5adf80d3d5668c290490852b4def2 (patch)
tree9decf048cb7600f2df1e66c54132b55a44e8daed /drivers/net/ieee802154
parent470770bf841b49fe129876300dfcb74a8bbabe99 (diff)
downloadlinux-13403d6952a5adf80d3d5668c290490852b4def2.tar.gz
ieee802154: hwsim: fix missing unlock on error in hwsim_add_one()
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>
Diffstat (limited to 'drivers/net/ieee802154')
-rw-r--r--drivers/net/ieee802154/mac802154_hwsim.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/net/ieee802154/mac802154_hwsim.c b/drivers/net/ieee802154/mac802154_hwsim.c
index 9319780a52ca..07a493dea11e 100644
--- a/drivers/net/ieee802154/mac802154_hwsim.c
+++ b/drivers/net/ieee802154/mac802154_hwsim.c
@@ -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);