Commit a515d0a5 authored by Tobias Geerinckx-Rice's avatar Tobias Geerinckx-Rice Committed by Kent Overstreet
Browse files

bcachefs: Enforce SYS_CAP_ADMIN within ioctls



bch2_fs_ioctl() didn't distinguish between unsupported ioctls and those
which the current user is unauthorised to perform.  That kept the code
simple but meant that, for example, an unprivileged TIOCGWINSZ ioctl on
a bcachefs file would return -EPERM instead of the expected -ENOTTY.
The same call made by a privileged user would correctly return -ENOTTY.

Fix this discrepancy by moving the check for CAP_SYS_ADMIN into each
privileged ioctl function.

Signed-off-by: default avatarTobias Geerinckx-Rice <me@tobias.gr>
Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 508b1f71
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment