Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3008220pxb; Mon, 18 Oct 2021 06:30:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyCQ/Y+KuHXUYL5qp2UoZihY9576C2JtKMS7Il/CLCVRK3qi0wwcM+0+EOAmS694bmnqIyT X-Received: by 2002:a05:6a00:a13:b0:44d:c927:b962 with SMTP id p19-20020a056a000a1300b0044dc927b962mr7772164pfh.41.1634563852091; Mon, 18 Oct 2021 06:30:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634563852; cv=none; d=google.com; s=arc-20160816; b=wMHsicTQVMUF89foqpGmyUTrhAB39exhT/aM02ZBej6FEdbJE4iBa0Slv2HJ0q7Bv2 bsAIKWX2ab+5MKKN9akBHre6UlTfD4IlwqUif22AbQdN4qKwjVUvAmiwrPxK+rr61fAb AVW8WZ2o6Ni8Xql2pSOK6WrF/c16VHXiI6cBZ8bt3IINfSVk1V5wcWsGx1H6/NYopEey 5F4KIlQAFhENc4vbXxSBtxjCAxN+j6TMHq8OZr/l4mGeEqNGGib59KfgLaFudgGA/VIO EWgIQibKit3BcmmklVJAplHnGsPyrgw09YaKIW7ufti2H3mDjntd3VcRu0iY3+t86gPy U1oQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Yq3yuENzcb5tUxNxra2l9GgNleRpfguLfpIyLCEiFxk=; b=so8b50PD+fOlQ8KRzpg8EqjPj6053h62UOeyCZlk5N8Ku++dw9kDvb9a2d9E84hdbI ZFFHf8AcFD8As/9JUWkkVcmMybk594S14BU+gCcN10mq51Xg9Q82bKzWqRWrG60KWYLP UEf/N2+XB3wxNzamicDjXfoLHXTXmDGBuopKvcx9FIy6tOLVDSbQsqI6GtibhTKlpws7 8e9fqj1YVeL2Jc7KJDe4GPLuKJjbpgupXBUveZYeZh1WTjrZ0iPpl4DbrY4gD64DKU5Y FTIl7Boq9hR0e0Zge1YIqUT/GgltwFDbISKnFa+3A1fKjNBsrcacZkVptWkbzOHKBj5I gQfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ULr0xe5j; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u189si11154784pgd.483.2021.10.18.06.30.38; Mon, 18 Oct 2021 06:30:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ULr0xe5j; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232496AbhJRNaQ (ORCPT + 99 others); Mon, 18 Oct 2021 09:30:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:41422 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231920AbhJRN3I (ORCPT ); Mon, 18 Oct 2021 09:29:08 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 74E2761362; Mon, 18 Oct 2021 13:26:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1634563606; bh=mIfWHTo6F5vNmIUpGiI4Mgv2twSJ0V9JjEE+iJXG1q8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ULr0xe5jTc36/lCozQEsAtfAFAHmvxgOjYbjBbbjE+9TSXGDi6lb5J7JMSxPfM6OF JfYacT9D5IIVyzq0jpHUdn8sUXKzaTZfPv5mrWDikOVUQZmoD6UdqS73nTyyHeJ94r auN2bWHWFWHAPGWc1Aow7IFDgOkq5qpb7uq8viJI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ziyang Xuan , Krzysztof Kozlowski , Jakub Kicinski Subject: [PATCH 4.14 31/39] nfc: fix error handling of nfc_proto_register() Date: Mon, 18 Oct 2021 15:24:40 +0200 Message-Id: <20211018132326.441888479@linuxfoundation.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211018132325.426739023@linuxfoundation.org> References: <20211018132325.426739023@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ziyang Xuan commit 0911ab31896f0e908540746414a77dd63912748d upstream. When nfc proto id is using, nfc_proto_register() return -EBUSY error code, but forgot to unregister proto. Fix it by adding proto_unregister() in the error handling case. Fixes: c7fe3b52c128 ("NFC: add NFC socket family") Signed-off-by: Ziyang Xuan Reviewed-by: Krzysztof Kozlowski Link: https://lore.kernel.org/r/20211013034932.2833737-1-william.xuanziyang@huawei.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- net/nfc/af_nfc.c | 3 +++ 1 file changed, 3 insertions(+) --- a/net/nfc/af_nfc.c +++ b/net/nfc/af_nfc.c @@ -72,6 +72,9 @@ int nfc_proto_register(const struct nfc_ proto_tab[nfc_proto->id] = nfc_proto; write_unlock(&proto_tab_lock); + if (rc) + proto_unregister(nfc_proto->proto); + return rc; } EXPORT_SYMBOL(nfc_proto_register);