Commit f0412b6e authored by Dan Robertson's avatar Dan Robertson Committed by Kent Overstreet

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: default avatarDan Robertson <dan@dlrobertson.com>
Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent b00fde8f
......@@ -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);
......
Markdown is supported
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