Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3016142pxb; Mon, 18 Oct 2021 06:39:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwavHp65BMRUO6DFL/0aa6Rw4cqYaDkRB7adnhFzGSA4OVyz2JiMTJXHMmPwJ/fjglM8BZS X-Received: by 2002:aa7:9523:0:b0:44c:c171:9ae with SMTP id c3-20020aa79523000000b0044cc17109aemr29146408pfp.75.1634564396151; Mon, 18 Oct 2021 06:39:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634564396; cv=none; d=google.com; s=arc-20160816; b=PMt5nrazb8iK56L1KOkbdylSMp+C5+1n5fVcVl0M42FliWPjCiJlPS2F4nmX2nMvLK zaaX6EBggffk4UTAfMUYW+JO6Gm1Hfwbl4OtlXsi6JxvcP5ZbyBVdI7a6ZbRHztOBHnD dyhK1H14/mNLnLLhVcxc86uFgwPaPNFSyI13SQO4mIUSoPTShxDUrPyQtZmqw2J9dgi6 JLWlJdC40UB8cZX2usRRGcuMQMSDm1PJSmHhvNyaM4R3WB4SzKNZy/bwVd/lfsfvSfBw dp0TiPntwtBDl6DvashEiPnNY4TqtuZEeomo47GEYnSYWz0uH+0C40iLPH6pzH9zLXjF DHzw== 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=g38F+DON/cAMcVsXcmn9ejJwQzvoeuDUKXsoOKlNiik2JQW7moSL81ssla15vNqJNW 34mNLigRTYE7MYq5oBcltC3ITImpmzJSP7uQvPOHqojnU+PkjpU6wijATK32mHkUQzf8 arQU1VLylANJ+gTTRRtKvjt4Ge5OJuYZtbdKqLvCFNopdKOtw0dNxb51js8RHDEf0hgK 3zJpDEMY8AyQrsnLWvcHAxlaB7dqCW4iv80yZhq0EatubzIIwjh9qKL2xpCPdWr/97tP cVoyvwIMUahH+tmIt4lzk64QPb4BjVdsc4kpJ3l0I0/eaMbPnFYnHvWH5i9YXZzxE6am KKDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=aGo6WtnJ; 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 f10si21377645pgv.131.2021.10.18.06.39.42; Mon, 18 Oct 2021 06:39:56 -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=aGo6WtnJ; 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 S233578AbhJRNkp (ORCPT + 99 others); Mon, 18 Oct 2021 09:40:45 -0400 Received: from mail.kernel.org ([198.145.29.99]:56366 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233674AbhJRNig (ORCPT ); Mon, 18 Oct 2021 09:38:36 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 62377610A1; Mon, 18 Oct 2021 13:32:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1634563932; bh=czaI13gQk7wRy9J0Hi5zKCZKM6yOkAkNqxw0VBmSeSw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aGo6WtnJHOYw/89TV5fypRFw4vBxTOYZYEH98KqI+Yhj8EJx8PA7qR0Re0B0D9BI8 8a/CyX0Oc6Wl13BqzPiA5sfJYTvruwdqGYygbm0WNWNvv4msnntbx+j0kYMxp4NnBJ q7EahB46FeazlVpnu3uD+RHeNALPHtU2i74Q+SAY= 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.4 53/69] nfc: fix error handling of nfc_proto_register() Date: Mon, 18 Oct 2021 15:24:51 +0200 Message-Id: <20211018132331.242568414@linuxfoundation.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211018132329.453964125@linuxfoundation.org> References: <20211018132329.453964125@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);