Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9078821pxu; Mon, 28 Dec 2020 06:08:26 -0800 (PST) X-Google-Smtp-Source: ABdhPJzNtOsfqLcAslS7gecdMayisf/90O0hBz0umfD201yN6jpT7m/NbKIkTQZUr+tVkYdmGD1T X-Received: by 2002:a17:906:7f10:: with SMTP id d16mr41755189ejr.104.1609164505768; Mon, 28 Dec 2020 06:08:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609164505; cv=none; d=google.com; s=arc-20160816; b=uJVMHB4mCMSElghjrfnLPouEDhBfdaOW/R9w3c5V22m+Zm08PEozQuUBx5jbHgpwSH TjMu0jWHiljKSGMQ1iIN6K1NLV4OwreOe39fvLkidDfdM2YRjohUwqq9RihpaonXiTj3 BtSCl74teaO6mYO6iNf3MwJenFHa9ej5zo4xTj3hkOgNYsWGr+vV9oOrUNPqJdt+TQtM g8eWlvaYXmHF1X/fQNRI2m2aiA/RcIE6pquKH1G/hhJkRtg8cWVB9n3y1TXXMcLUajtY 5Oqcb/n6VPk2xAgt+koXUC7B8jrn3kXpVjZwruleAV1gROpEP4YL6e4ZKzQdGwqxVhqS qAjw== 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=Qm8m3k/bsNt/Ej7ucdaB9nbhhNt9wCzMOJvl2c0HIMU=; b=AT1sqLnma2avAhJhmfoj4QQxcOJjMekUsQMM1E+wFRla6DI0QBORf0WNXjSOlv8C4V df0zu1kf3YS2aPYwTg3QwasGq0WMcKi+QzZEQ53Sf2bIUme9oAptFTiqb/ZTbRs2MXxS ybAWGUHwPq4izOIb6qUjNzaryTypk53uIIHNXA9ck1EfP7pN3FsRkzctdgIcZcHrxuUz qGHlOAhf/MAxYV+uzmz6UNxscZQMdmoSUl12kSpZRg1LGIpeaXEHPsxCpB5K6ndPnU1w AeFEiQIdDF78iCSuKpqJ/Lj1eW9OczW1N0TLnghbUzTzQUPfJacWJd6wcDdPbHNmThhy 1uVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=P1vtLzaV; 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 z7si20598057edx.473.2020.12.28.06.08.01; Mon, 28 Dec 2020 06:08:25 -0800 (PST) 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=P1vtLzaV; 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 S2437269AbgL1OEF (ORCPT + 99 others); Mon, 28 Dec 2020 09:04:05 -0500 Received: from mail.kernel.org ([198.145.29.99]:38306 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727369AbgL1OED (ORCPT ); Mon, 28 Dec 2020 09:04:03 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5BCD0206E5; Mon, 28 Dec 2020 14:03:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609164202; bh=p+kYbOJpmrJ+mm5v3an7tXr+GUDnPviWZukcKIEvU3o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P1vtLzaVAI77YfFLDaixUAER1SHt+q0j+DPRCNQDdF/FOZ0fpgcF2FrL12V1JsLQn CRMvNs6cjE+xZja364NC5U44bpF6bDrN2VXjKoHkRUdfdykIuJnG3yZVuPO2KVPR/8 XIKfDnLvj1F6lp+j2wVWCipJ1mLGqq4S01/Vn618= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miklos Szeredi , Sasha Levin Subject: [PATCH 5.10 097/717] virtiofs fix leak in setup Date: Mon, 28 Dec 2020 13:41:35 +0100 Message-Id: <20201228125025.622765683@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228125020.963311703@linuxfoundation.org> References: <20201228125020.963311703@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: Miklos Szeredi [ Upstream commit 66ab33bf6d4341574f88b511e856a73f6f2a921e ] This can be triggered for example by adding the "-omand" mount option, which will be rejected and virtio_fs_fill_super() will return an error. In such a case the allocations for fuse_conn and fuse_mount will leak due to s_root not yet being set and so ->put_super() not being called. Fixes: a62a8ef9d97d ("virtio-fs: add virtiofs filesystem") Signed-off-by: Miklos Szeredi Signed-off-by: Sasha Levin --- fs/fuse/virtio_fs.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/fuse/virtio_fs.c b/fs/fuse/virtio_fs.c index 21a9e534417c0..d2c0e58c6416f 100644 --- a/fs/fuse/virtio_fs.c +++ b/fs/fuse/virtio_fs.c @@ -1464,6 +1464,8 @@ static int virtio_fs_get_tree(struct fs_context *fsc) if (!sb->s_root) { err = virtio_fs_fill_super(sb, fsc); if (err) { + fuse_mount_put(fm); + sb->s_fs_info = NULL; deactivate_locked_super(sb); return err; } -- 2.27.0