Skip to content

Commit e0a272f

Browse files
goldwynrgregkh
authored andcommitted
dm flakey: check for null arg_name in parse_features()
[ Upstream commit 7690e25 ] One can crash dm-flakey by specifying more feature arguments than the number of features supplied. Checking for null in arg_name avoids this. dmsetup create flakey-test --table "0 66076080 flakey /dev/sdb9 0 0 180 2 drop_writes" Signed-off-by: Goldwyn Rodrigues <[email protected]> Signed-off-by: Mike Snitzer <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 40a88da commit e0a272f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/md/dm-flakey.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,11 @@ static int parse_features(struct dm_arg_set *as, struct flakey_c *fc,
6969
arg_name = dm_shift_arg(as);
7070
argc--;
7171

72+
if (!arg_name) {
73+
ti->error = "Insufficient feature arguments";
74+
return -EINVAL;
75+
}
76+
7277
/*
7378
* drop_writes
7479
*/

0 commit comments

Comments
 (0)