From patchwork Wed Aug 8 03:10:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yongjun X-Patchwork-Id: 10559417 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2D7ED15E9 for ; Wed, 8 Aug 2018 03:03:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0BBD52A3E7 for ; Wed, 8 Aug 2018 03:03:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F03012A3F2; Wed, 8 Aug 2018 03:03:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 90AAB2A3E7 for ; Wed, 8 Aug 2018 03:03:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726579AbeHHFUt (ORCPT ); Wed, 8 Aug 2018 01:20:49 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:54813 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726258AbeHHFUt (ORCPT ); Wed, 8 Aug 2018 01:20:49 -0400 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id E13CA31F366EA; Wed, 8 Aug 2018 11:03:17 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.399.0; Wed, 8 Aug 2018 11:03:11 +0800 From: Wei Yongjun To: Alexander Aring , Stefan Schmidt CC: Wei Yongjun , , , Subject: [PATCH net-next] ieee802154: hwsim: fix missing unlock on error in hwsim_add_one() Date: Wed, 8 Aug 2018 03:10:39 +0000 Message-ID: <1533697839-85602-1-git-send-email-weiyongjun1@huawei.com> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 X-Originating-IP: [10.175.113.25] X-CFilter-Loop: Reflected Sender: linux-wpan-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wpan@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Signed-off-by: Stefan Schmidt --- drivers/net/ieee802154/mac802154_hwsim.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- To unsubscribe from this list: send the line "unsubscribe linux-wpan" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/net/ieee802154/mac802154_hwsim.c b/drivers/net/ieee802154/mac802154_hwsim.c index f4e9205..44d398c 100644 --- a/drivers/net/ieee802154/mac802154_hwsim.c +++ b/drivers/net/ieee802154/mac802154_hwsim.c @@ -810,8 +810,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);