[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1509571624-5001-33-git-send-email-w@1wt.eu>
Date: Wed, 1 Nov 2017 22:26:57 +0100
From: Willy Tarreau <w@....eu>
To: linux-kernel@...r.kernel.org, stable@...r.kernel.org,
linux@...ck-us.net
Cc: satoru takeuchi <satoru.takeuchi@...il.com>,
David Sterba <dsterba@...e.com>, Willy Tarreau <w@....eu>
Subject: [PATCH 3.10 132/139] btrfs: prevent to set invalid default subvolid
From: satoru takeuchi <satoru.takeuchi@...il.com>
commit 6d6d282932d1a609e60dc4467677e0e863682f57 upstream.
`btrfs sub set-default` succeeds to set an ID which isn't corresponding to any
fs/file tree. If such the bad ID is set to a filesystem, we can't mount this
filesystem without specifying `subvol` or `subvolid` mount options.
Fixes: 6ef5ed0d386b ("Btrfs: add ioctl and incompat flag to set the default mount subvol")
Cc: <stable@...r.kernel.org>
Signed-off-by: Satoru Takeuchi <satoru.takeuchi@...il.com>
Reviewed-by: Qu Wenruo <quwenruo.btrfs@....com>
Reviewed-by: David Sterba <dsterba@...e.com>
Signed-off-by: David Sterba <dsterba@...e.com>
Signed-off-by: Willy Tarreau <w@....eu>
---
fs/btrfs/ioctl.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 296cc1b..7831e68 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -2974,6 +2974,10 @@ static long btrfs_ioctl_default_subvol(struct file *file, void __user *argp)
ret = PTR_ERR(new_root);
goto out;
}
+ if (!is_fstree(new_root->objectid)) {
+ ret = -ENOENT;
+ goto out;
+ }
if (btrfs_root_refs(&new_root->root_item) == 0) {
ret = -ENOENT;
--
2.8.0.rc2.1.gbe9624a
Powered by blists - more mailing lists