From: Justin Husted <sigstop@gmail.com>
Date: Sun, 10 Nov 2019 03:15:40 +0000 (-0800)
Subject: bcachefs: Set lost+found mode to 0700
X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=b627c7d8f46ca74e78f6df63e8e2f15af124d1f7;p=linux.git

bcachefs: Set lost+found mode to 0700

For security and conformance with other filesystems, the lost+found
directory should not be world or group accessible.

Signed-off-by: Justin Husted <sigstop@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
---

diff --git a/fs/bcachefs/fsck.c b/fs/bcachefs/fsck.c
index 3cced2b99f3f1..0f2308e53d652 100644
--- a/fs/bcachefs/fsck.c
+++ b/fs/bcachefs/fsck.c
@@ -797,7 +797,7 @@ create_lostfound:
 		bch2_create_trans(&trans,
 				  BCACHEFS_ROOT_INO, root_inode,
 				  lostfound_inode, &lostfound,
-				  0, 0, S_IFDIR|0755, 0, NULL, NULL));
+				  0, 0, S_IFDIR|0700, 0, NULL, NULL));
 	if (ret)
 		bch_err(c, "error creating lost+found: %i", ret);
 
diff --git a/fs/bcachefs/recovery.c b/fs/bcachefs/recovery.c
index 2c441a2780446..d1184bf62cae4 100644
--- a/fs/bcachefs/recovery.c
+++ b/fs/bcachefs/recovery.c
@@ -1013,7 +1013,7 @@ int bch2_fs_initialize(struct bch_fs *c)
 		bch2_create_trans(&trans, BCACHEFS_ROOT_INO,
 				  &root_inode, &lostfound_inode,
 				  &lostfound,
-				  0, 0, S_IFDIR|0755, 0,
+				  0, 0, S_IFDIR|0700, 0,
 				  NULL, NULL));
 	if (ret)
 		goto err;