Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp9940746ybi; Wed, 24 Jul 2019 12:43:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqx70W8kow142MQ/t8mAQlCsenP4F2O+YhNDrnzvuZnCWZ9c1LWIAVPCrudKJdarMemzXjdb X-Received: by 2002:a63:f456:: with SMTP id p22mr7114655pgk.45.1563997394564; Wed, 24 Jul 2019 12:43:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563997394; cv=none; d=google.com; s=arc-20160816; b=Xjo2os2ufr+ggC6c7a8GhTDnfF1UokETG1JJT1HgRp+rRUzWaGDqlCjPgtgQzSb68R EnqF9fvuhxNKXwmkqtz2NEaPB/BHue2JA//YxQ+Xgk8Zne9e/S8zwpgWD5O3ktpht1jr lrNh2zXC6Vt3hXBu+esKcyzVidxHSpUptCeiu69zKVq1vA6BBpNpbOXzfQs1mjvdEKoD MtvyrVf1ZMSu5MNR5xc3JfCUfIjAZ2suzFge5dfAfPlk3I3KR6nDJh6WIqm0FAbOWV6Q KXZqcQcz96UP0BqYpvx3q0BCN7Wna7+Rft67/lAcMi/6oxYfugYHfYWwwXvxP1cNsaQ6 ic6w== 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=N0N+yKV3bZIsv/LKUglcLDoyBoWkjdhyNWUFXq2pJUn/tCQFZW5Cftgci+8ZIqnROc F8M9S/paTatbPTvvIx060wKpOy4/fNvzbR/iOpVBh1vpX6WIXQ+SYVXHsNdTqUqgGOmS hxg55t+oDz62lmJsrrOTl121BKeBsJa3Bj39X0EzVKYQ7NN6ryQqgbmu3ATJqGV43+Vt yb/SoZOwy12lBG4QnG3lGYQUYAczfAha4ooO97cxoUfbgDSGLypEY0bL5tC5BKJ/z99Y I7DiN64k3ZsXJe12BOKKvAhuckihqmBtEWVEEIWgfgfu7a+kaTHdKAB8nMO3V4Ep+0EP tOvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=kMoQViAr; 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 m17si16940344pgg.539.2019.07.24.12.42.59; Wed, 24 Jul 2019 12:43:14 -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=kMoQViAr; 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 S2390245AbfGXTlr (ORCPT + 99 others); Wed, 24 Jul 2019 15:41:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:43204 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389666AbfGXTlo (ORCPT ); Wed, 24 Jul 2019 15:41:44 -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 C8EF3229F3; Wed, 24 Jul 2019 19:41:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1563997304; bh=hpH3G4a7G/KVsYa4id/3HXxZbpYaTdI/T6rleRNvGhI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kMoQViArEP+8po56MDY1XWozjcV9Nl/WdXUhhGE0lJGqs2Pcx2ncpXrC0kQ7uK9NI W1BYVMIPI1J2sWA/stHM6QRsly3Z3+MnNUD/CZ5WhmskRI5ww+K8aeqbJ4q9y9NRSa cBxs4t5lYIernJtyl2cJ44vUo/OgbCCmD0k10FDw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, YueHaibing , Dominique Martinet Subject: [PATCH 5.2 349/413] 9p/xen: Add cleanup path in p9_trans_xen_init Date: Wed, 24 Jul 2019 21:20:40 +0200 Message-Id: <20190724191800.790232814@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190724191735.096702571@linuxfoundation.org> References: <20190724191735.096702571@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);