diff options
author | Dan Robertson <dan@dlrobertson.com> | 2021-07-08 18:15:38 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:09:08 -0400 |
commit | f0412b6e44bba6dc6f36feab560c4d325f9f021e (patch) | |
tree | d85d881003ae41a38cb3f1858b0d18b988c03cb4 /fs/bcachefs/chardev.c | |
parent | b00fde8fb1e7271a4c07ed89249a115ccea96cc3 (diff) | |
download | linux-stable-f0412b6e44bba6dc6f36feab560c4d325f9f021e.tar.gz linux-stable-f0412b6e44bba6dc6f36feab560c4d325f9f021e.tar.bz2 linux-stable-f0412b6e44bba6dc6f36feab560c4d325f9f021e.zip |
bcachefs: set disk state should check new_state
A new device state that is not a valid state should return -EINVAL
in the disk set state ioctl.
Signed-off-by: Dan Robertson <dan@dlrobertson.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/chardev.c')
-rw-r--r-- | fs/bcachefs/chardev.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/bcachefs/chardev.c b/fs/bcachefs/chardev.c index c1d8143b3fd8..aae9a2db8b0d 100644 --- a/fs/bcachefs/chardev.c +++ b/fs/bcachefs/chardev.c @@ -275,7 +275,8 @@ static long bch2_ioctl_disk_set_state(struct bch_fs *c, BCH_FORCE_IF_METADATA_LOST| BCH_FORCE_IF_DEGRADED| BCH_BY_INDEX)) || - arg.pad[0] || arg.pad[1] || arg.pad[2]) + arg.pad[0] || arg.pad[1] || arg.pad[2] || + arg.new_state >= BCH_MEMBER_STATE_NR) return -EINVAL; ca = bch2_device_lookup(c, arg.dev, arg.flags); |