Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3786999ybi; Mon, 29 Jul 2019 12:36:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqwJej1TdmbdinxDdncsKah5yVLwEVJALzP5An4xSgPadws8FJ5mSWwBfTd62MqfFJ8CC7gC X-Received: by 2002:a17:90a:2506:: with SMTP id j6mr79926225pje.129.1564428998832; Mon, 29 Jul 2019 12:36:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564428998; cv=none; d=google.com; s=arc-20160816; b=zGHNndo6qJ9f/k9iNaKhdoB2tyehjlCfUEn+SWtTVai2fbWMjYlekYdc/AC9J+MSOm aNHt5lmi93L/gFIhwVhViaiogDrfpfX2eaT4BvwWIPbGuQUPE/Peog2ue55yb89FxbdZ nDlUCDGA530poqiovpWvPcYJO/JKtFldRZu2hd3fc+mgrG5Bpk7snTHdB80cFbV7Pd6H c0w20mUNQgHGQ1fxsU6zCaa7sn4H67INncWtp77uXpgZbGdYmho4k8DEC7dSmvw/DWqz Yys5Y5jLFv5zm8FLbXYpfe5kPAuuo7c+PoKJB2z1dvlIfesTKl3CjC9rMFmZRp2HgPvA p33Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=E4vOh/6lWt3S4OjEmL95mMWsZouAxi1uPQLGEjpOPyA=; b=oU7gkgp8Dkey8QgssbDMR0kagUKAQmFmGLwf3RyVWISKFNcwSspdGEHhWGLvAzk2c0 u1VioTcSaYXztep+iBJ5YIbqLGwD25T9YNuzl84SJnBBq4T/Ek8+b+3oWPKnjT3EkDE1 l8iR8E0nqpO4Ox+jJJa9CzbaRcEExwvSVMSCKpt9dnu3R4u+eHJUCXCYEYdsu6dUhmVl a2f6MUfM3jExiL9iFFZ2pdD+pfwSkBeChKd1GVnxvPJjp/k+odGXmFgl52Ik1pEdA73d Btwhp07A1zlmWD385zZ2lWcJRLRC/uC23ruWWKTc61Vy8/vwi9CSyhWLMBreVf/8UPIF 4X5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=nM2pZJCv; 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 x2si28119030pgp.475.2019.07.29.12.36.24; Mon, 29 Jul 2019 12:36:38 -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; dkim=pass header.i=@kernel.org header.s=default header.b=nM2pZJCv; 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 S1730335AbfG2TdT (ORCPT + 99 others); Mon, 29 Jul 2019 15:33:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:47350 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727632AbfG2TdR (ORCPT ); Mon, 29 Jul 2019 15:33:17 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 09A0B2171F; Mon, 29 Jul 2019 19:33:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564428797; bh=hpH3G4a7G/KVsYa4id/3HXxZbpYaTdI/T6rleRNvGhI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nM2pZJCvhBGc2bFdiOt9QB+QbLhZT2UOa064zDr15HIX8O21p1YO4+pPvBCrpFf1Q 1z/SrTGg1CIgZqqekx+X37at0/M0wINYXUwsTQfoHTxU7ORbP5Kcca1sTGcwVWYJ74 jh/nFLsbfkEVPj7qy93laEFugCQlWHXMPSSetO+4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, YueHaibing , Dominique Martinet Subject: [PATCH 4.14 150/293] 9p/xen: Add cleanup path in p9_trans_xen_init Date: Mon, 29 Jul 2019 21:20:41 +0200 Message-Id: <20190729190836.072990654@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190729190820.321094988@linuxfoundation.org> References: <20190729190820.321094988@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: YueHaibing commit 80a316ff16276b36d0392a8f8b2f63259857ae98 upstream. If xenbus_register_frontend() fails in p9_trans_xen_init, we should call v9fs_unregister_trans() to do cleanup. Link: http://lkml.kernel.org/r/20190430143933.19368-1-yuehaibing@huawei.com Cc: stable@vger.kernel.org Fixes: 868eb122739a ("xen/9pfs: introduce Xen 9pfs transport driver") Signed-off-by: YueHaibing Signed-off-by: Dominique Martinet Signed-off-by: Greg Kroah-Hartman --- net/9p/trans_xen.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) --- a/net/9p/trans_xen.c +++ b/net/9p/trans_xen.c @@ -530,13 +530,19 @@ static struct xenbus_driver xen_9pfs_fro 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);