Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3024102pxb; Mon, 18 Oct 2021 06:49:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw5AAonk5SSy9b5dUH1utyxADTfmAyYsP57gNIGgzFAU+eD9b96XegMuBxLrqMHAivpcjzg X-Received: by 2002:a63:d114:: with SMTP id k20mr23835046pgg.2.1634564969831; Mon, 18 Oct 2021 06:49:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634564969; cv=none; d=google.com; s=arc-20160816; b=ZirgHzYblSis8+oQx1xNN6QWlMMNxrt6mz41OaX46kgXfi3Bg8sUzrO1fsCeJWTp7p 0xMOgCWcNIuri/mnKn0m6F7EpjcS4HvE+Rh0sS7OKVeKEiSQWOVbFVe5iJCXLKW1WdNy jmnHQqdWqbRoDuu6h4/mRM0fy5Jml2hh5RbzKFwBDjW/1ozVV3IV5Ad69YVGDZgNzvDE J8mje1fy7fhUXBcP9LDwWSuovFszbDgOHlL+0PE1OEm7gkDeVnjZUOATgBAOX+ArMBtH xF1y8yAHDkdAXCdNdBF1NfVe/SkvIqsI9U1/NIt8L1K/lo4IE5tQuPGJgKjd/oTpBsnz Eofg== 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=JJ5ZmU1tFJbHrv00MbradcIO7u9Ut6aU6OlsBbrAZr8=; b=FgOWXBFP2eQvW/4yq8tVt+Z9wjegCdxK44bXFGzmnFr8jYHlLTbIFHcBLE6idLhaOX Nkej8UqtHl4afrl+phk9lJXlImzmr3ew+smbxbhoVmIIjbZ6NwMdbQWef8XkHEchP3on SDDzdo3bZ5GBVjbj4v2asdevAwXdLF6YUVFNMBn2v1zo5Hyuhu+FtEnqmU1CZyI6Qo0f 89lAr4nuIiBD9m+ObGaq1BSdbaJRYSJJigwbmsNNIhm1PsvhzEOSqcFlQf08S+lERi1H bZZL1C6tg58BcKvbH2FDDbEN5avGGvNa9+F9az2gdHD0UNwZOpi7hYxqV6jQ1jStIg7h bU7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KnbZWOZC; 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 a6si24786949plh.349.2021.10.18.06.49.12; Mon, 18 Oct 2021 06:49:29 -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=KnbZWOZC; 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 S232697AbhJRNs5 (ORCPT + 99 others); Mon, 18 Oct 2021 09:48:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:40198 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233868AbhJRNqR (ORCPT ); Mon, 18 Oct 2021 09:46:17 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 820CD6162E; Mon, 18 Oct 2021 13:35:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1634564157; bh=czaI13gQk7wRy9J0Hi5zKCZKM6yOkAkNqxw0VBmSeSw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KnbZWOZCO1ZfrRga1MMB2yWfoHIGPbd+UTIJ9GcALUT0G3+d9NbX74Z5oxR74SpDJ +QEdQYCeTKmo3Dyk57SCxJYjHc/kEnLF/n7CJeA4vCyURTmkTUuxwp1s/EBjLJGLLj bQxin8D39ooNH5InhEMho4hSnPMLNZDXtUgJhgW4= 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 5.10 079/103] nfc: fix error handling of nfc_proto_register() Date: Mon, 18 Oct 2021 15:24:55 +0200 Message-Id: <20211018132337.410206165@linuxfoundation.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211018132334.702559133@linuxfoundation.org> References: <20211018132334.702559133@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 @@ -60,6 +60,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);