Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3009460pxb; Mon, 18 Oct 2021 06:32:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwma34nA1z42njGvpl6UKtHaFViuD9uq6MvX9iQi2C9XZBxLsAxByTqZpYQNxxe30q5gRVI X-Received: by 2002:a17:902:d50b:b0:13f:69af:5ae7 with SMTP id b11-20020a170902d50b00b0013f69af5ae7mr27450194plg.39.1634563927187; Mon, 18 Oct 2021 06:32:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634563927; cv=none; d=google.com; s=arc-20160816; b=VbZ+c7j4vbg8whfRH68HbHOFHJZyRp5szkD3x8p/9xLiCDyf499dIp50FvZCq7SdpH pGYB0jwuyzOi2yHVwmx1H7ncnoKDSeU+Ew9//Lg21efT/Fl++VUgSAMbzYRZVJjMDh8I hekpZvtGPsSikWXecZadA+GzFWl5v0xqhEp2uORLKOiEEktP4iTRpqSSbHVGLNDotsYg euDQ5Hp7zXFJataplu19eG777nd3nntNUzEQxm8h4FZCqW5iyyMrtVufMoHoTIKiB2MS NmEftWzV10artrykclRgLhGsjEyg0rm82doig3E2qgBUjNyzsc46VXAonYHVSTCVMTAo 5JnQ== 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=jdcexDAdc2UdGvsC4UXIe2AyDZWXMqK6/n/FF7qNGL5MGc2rbv46jOkuWjnsG/Gj/4 Hxr7wzMmV8tAYAuCNgXyNtyvxH//q+OjDiBy8maH4rFIigPgeupX0GRWGHuk3uk5+kwO mpUxFWWYM3FY+lRL3DbGIWL0AKIUYyMS4Tma0puEZmpbO4xwnHKJx4yAA5/ggEPlkw1y nkEhUkhU7Fhln7cWz1+lCdTU65HXjZbOomzKXnvqsTfoa54XdL7rANiAAZ3zyJhgZy1v grt6N2oq2lRdgLyDAKgjvyTlIMcaCKVryExX/j1ZQXdCgaoOpddfE8IVP/hJv1GmOz5J lJlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mYNf+4T+; 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 g4si19309529pgm.349.2021.10.18.06.31.52; Mon, 18 Oct 2021 06:32:07 -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=mYNf+4T+; 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 S232730AbhJRNc7 (ORCPT + 99 others); Mon, 18 Oct 2021 09:32:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:43392 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232361AbhJRNbD (ORCPT ); Mon, 18 Oct 2021 09:31:03 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 23D496136A; Mon, 18 Oct 2021 13:28:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1634563719; bh=mIfWHTo6F5vNmIUpGiI4Mgv2twSJ0V9JjEE+iJXG1q8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mYNf+4T+IFKRaizpfv9QLNLuLNgl+pnPlTBUEO3/3Xl2VmmtqoN3anM6dBAlF88or EuEzUkgZ1I4FES2wOb2CmYZj6R1K4lwmfebqt0s6qMb0sGRktgwSucxGykBCVzwabb lZMNrOBfE3fGrFxVRWMYNhaYCpKIKAcTz0qHtF5I= 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.19 38/50] nfc: fix error handling of nfc_proto_register() Date: Mon, 18 Oct 2021 15:24:45 +0200 Message-Id: <20211018132327.785476316@linuxfoundation.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211018132326.529486647@linuxfoundation.org> References: <20211018132326.529486647@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);