From b627c7d8f46ca74e78f6df63e8e2f15af124d1f7 Mon Sep 17 00:00:00 2001 From: Justin Husted Date: Sat, 9 Nov 2019 19:15:40 -0800 Subject: [PATCH] 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 Signed-off-by: Kent Overstreet --- fs/bcachefs/fsck.c | 2 +- fs/bcachefs/recovery.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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; -- 2.30.2