Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp10425737ybi; Wed, 24 Jul 2019 23:00:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqznjRcdAHqfa8aNZwEFwoIudcFHrRAifpKINDG7Rj9voYntr9lGMN3Q/gQoH2ZqgyA3cvpa X-Received: by 2002:a17:90a:bf02:: with SMTP id c2mr91868369pjs.73.1564034447600; Wed, 24 Jul 2019 23:00:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564034447; cv=none; d=google.com; s=arc-20160816; b=Pxgd6AQt8DQPwzjkEa9oQt59tzhSbL/6duWK3r1gGZALdGl0fXvBxyTY2Q840yLiho /lCCc52WEn5b16fmTC3ELbDSdOIwqroYPHznOJE6BBbXr1XK9F7LMf15Zk2TWfjnBmJn i38xx6dt94TjTIq6OT/NpHce5dSKQKM7ON2QYQXbXA/muEx6YUBHYgMQ89ZxFG1NDfY4 xH1YTg4oPs3k4qMkmKHK7AYa42ePRDsXmiik02BUfV47vrMhO/C8CLiQ4ZdWqs2FPbzr TTHfRUN7pnNF4NXkpzh0M7ciyZpHSp4LpWOI3yQ9fRnNzVMUpYI85B+0l61DkkjaVkzG uUaw== 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=jwQqYB8DDpueWl413bKbczvf0tR8Jc3BKL7W5Ae1KfjwTbPI7/tJfwD2V6xZ2h5yli D4q462jbEamEaCrdK6G5Q3vG4jk13M+aIqZY4KDuGRZT3LzjIetIVo7okI9TT31eFVma poWuVsZ4t0xuH5Fsfq+qQLf5L7xW5ARQxTwSMdAeJkzAzjAjC+7AGqEEyxDmaP/WxdCf pFtFzuIunRGs3pJatPxRsmWzZNj9BHQadXIm5IOvCht6ths6uzCDrZPuaW5e8qP4TOWY im23ST9lJwgx9ghZlUY2KwsadiU2YC8GO71sXktaTA3FZPhhhm5bCsLE7EH7CPE0kKDj mRGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=rxLBgHrb; 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 f64si18670805pfb.151.2019.07.24.23.00.33; Wed, 24 Jul 2019 23:00:47 -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=rxLBgHrb; 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 S2404977AbfGYFog (ORCPT + 99 others); Thu, 25 Jul 2019 01:44:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:59712 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404959AbfGYFoe (ORCPT ); Thu, 25 Jul 2019 01:44:34 -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 27B0022BF5; Thu, 25 Jul 2019 05:44:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564033473; bh=hpH3G4a7G/KVsYa4id/3HXxZbpYaTdI/T6rleRNvGhI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rxLBgHrbxCeS7ot2v9/QZvXhi5N08jHUF/bGmUoSmVLeCC3i/s2OkKJ0D2v/0khja lQosvZQluercq/Pr9OpTn9OKyu4CUA8rAppQC09qOr5TDsAoLQx/zsSdjVBJCX/8FA dw8WyBYitIovpott1IbjNxqg0Hzn0v0H95To8TL4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, YueHaibing , Dominique Martinet Subject: [PATCH 4.19 221/271] 9p/xen: Add cleanup path in p9_trans_xen_init Date: Wed, 24 Jul 2019 21:21:30 +0200 Message-Id: <20190724191714.072527248@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190724191655.268628197@linuxfoundation.org> References: <20190724191655.268628197@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);