Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp5003927yba; Tue, 30 Apr 2019 07:42:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqwysAPj2bFlN65wx64gwKnsn+O2/aTKJlvuxG2Zj/21mprlJ8Xou4UAJOOcn3dMlRSWgmFb X-Received: by 2002:a17:902:a513:: with SMTP id s19mr3069415plq.97.1556635368965; Tue, 30 Apr 2019 07:42:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556635368; cv=none; d=google.com; s=arc-20160816; b=W0IJaMa1MIpqw+wYB59ng2nZVM4AJItAdCmVIuoKPrWEwFRaifyP+Z054XLXpb21RF hpwlV5XfHw65JeuL2rxdrOXYQ+9c5XSFKZ0Jduai+dN4HBiXkQ5lU0ZSf3TPfWxvNrTp vSZMlWmIUUy1rPcv7nKObWB2TGc8bgpeVoy6zGukPvfu0s7B+MhOzzhuSMJzQeq5cm2Q xmyFeoV1jPOJE7aPMQMPZMuX3Zaz7wVy47/1za/Ikj8BQsBZqHHQi2Dqket9OqUlVhMt j2rEkpH5toqRmvDXNkNxxRZpZUCJ8Ewxn0gn/vdQki1s9O59fQVI5qHRT5TLe4BFI54K Apdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=U5D4pUstJ6PxCeW5ah+XAzKGWxpGDZeXyD9NyBvW0dw=; b=io8Zi2cRzaaOH6R1Qr2lxz0POCsxmuBFZTvLtuP3AMhtX0bn3dWk3aw5wimf7Hqm9i 5AiIVS0q6MFB+OgZruZQV2kzJL9G2apMnatrQFrPvp3901AtB8OrQWQ6ooRGr975Wp9w 6jtcwv9BzwuifSDcBfoIXhsDXpyq74J5+QTANS7v4PFeoE0cKVMUVVUIwfQTBjh0u52a 95GEdOt4CNQlKR1hexBrXlVM3Qin+g44fXQ1iJOylySAoUXD/OGL+DKsxVJ5Sa6vz/8X gZ9h0TKeSlWiB0wly3fLzgjqvWdAeLG8tYEFy3MdypyKw61QdV5NPzWCczxB2NPtkZkM ZO4w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id gn15si10416715plb.77.2019.04.30.07.42.33; Tue, 30 Apr 2019 07:42:48 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728049AbfD3Olj (ORCPT + 99 others); Tue, 30 Apr 2019 10:41:39 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:7149 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726073AbfD3Olj (ORCPT ); Tue, 30 Apr 2019 10:41:39 -0400 Received: from DGGEMS408-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id B43494593EFE64FF1F6E; Tue, 30 Apr 2019 22:41:36 +0800 (CST) Received: from localhost (10.177.31.96) by DGGEMS408-HUB.china.huawei.com (10.3.19.208) with Microsoft SMTP Server id 14.3.439.0; Tue, 30 Apr 2019 22:41:29 +0800 From: YueHaibing To: , , , CC: , , , YueHaibing Subject: [PATCH -next] 9p/xen: Add cleanup path in p9_trans_xen_init Date: Tue, 30 Apr 2019 22:39:33 +0800 Message-ID: <20190430143933.19368-1-yuehaibing@huawei.com> X-Mailer: git-send-email 2.10.2.windows.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.177.31.96] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If xenbus_register_frontend() fails in p9_trans_xen_init, we should call v9fs_unregister_trans() to do cleanup. Fixes: 868eb122739a ("xen/9pfs: introduce Xen 9pfs transport driver") Signed-off-by: YueHaibing --- net/9p/trans_xen.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/net/9p/trans_xen.c b/net/9p/trans_xen.c index 29420eb..3963eb1 100644 --- a/net/9p/trans_xen.c +++ b/net/9p/trans_xen.c @@ -530,13 +530,19 @@ static struct xenbus_driver xen_9pfs_front_driver = { static int p9_trans_xen_init(void) { + int rc; + if (!xen_domain()) return -ENODEV; pr_info("Initialising Xen transport for 9pfs\n"); v9fs_register_trans(&p9_xen_trans); - return xenbus_register_frontend(&xen_9pfs_front_driver); + rc = xenbus_register_frontend(&xen_9pfs_front_driver); + if (rc) + v9fs_unregister_trans(&p9_xen_trans); + + return rc; } module_init(p9_trans_xen_init); -- 2.7.0