Skip to content

Commit

Permalink
xfs: fix scrub stats file permissions
Browse files Browse the repository at this point in the history
commit e610e85 upstream.

When the kernel is in lockdown mode, debugfs will only show files that
are world-readable and cannot be written, mmaped, or used with ioctl.
That more or less describes the scrub stats file, except that the
permissions are wrong -- they should be 0444, not 0644.  You can't write
the stats file, so the 0200 makes no sense.

Meanwhile, the clear_stats file is only writable, but it got mode 0400
instead of 0200, which would make more sense.

Fix both files so that they make sense.

Fixes: d7a74ca ("xfs: track usage statistics of online fsck")
Signed-off-by: "Darrick J. Wong" <[email protected]>
Reviewed-by: Christoph Hellwig <[email protected]>
Signed-off-by: Chandan Babu R <[email protected]>
Signed-off-by: Catherine Hoang <[email protected]>
Acked-by: Darrick J. Wong <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
Darrick J. Wong authored and Avenger-285714 committed Jun 23, 2024
1 parent 3aa1e5a commit 6f3dd7e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fs/xfs/scrub/stats.c
Original file line number Diff line number Diff line change
Expand Up @@ -329,9 +329,9 @@ xchk_stats_register(
if (!cs->cs_debugfs)
return;

debugfs_create_file("stats", 0644, cs->cs_debugfs, cs,
debugfs_create_file("stats", 0444, cs->cs_debugfs, cs,
&scrub_stats_fops);
debugfs_create_file("clear_stats", 0400, cs->cs_debugfs, cs,
debugfs_create_file("clear_stats", 0200, cs->cs_debugfs, cs,
&clear_scrub_stats_fops);
}

Expand Down

0 comments on commit 6f3dd7e

Please sign in to comment.