bcachefs: Set lost+found mode to 0700
authorJustin Husted <sigstop@gmail.com>
Sun, 10 Nov 2019 03:15:40 +0000 (19:15 -0800)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:08:31 +0000 (17:08 -0400)
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>
fs/bcachefs/fsck.c
fs/bcachefs/recovery.c

index 3cced2b99f3f14a3ed3ee0688df7d98797a134bf..0f2308e53d652dfe86344f3e67c26f527b07554e 100644 (file)
@@ -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);
 
index 2c441a278044656188c3ef519c5cddcf6b0788e9..d1184bf62cae4e120cc61adf56df7351e2ff1921 100644 (file)
@@ -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;