summaryrefslogtreecommitdiff
path: root/drivers/md/dm-flakey.c
diff options
context:
space:
mode:
authorGoldwyn Rodrigues <rgoldwyn@suse.com>2017-12-04 06:14:12 +0300
committerMike Snitzer <snitzer@redhat.com>2018-01-17 17:16:13 +0300
commit7690e25302dc7d0cd42b349e746fe44b44a94f2b (patch)
treec2172d68ef5a03d1a309be7d7fbb10605ecc8274 /drivers/md/dm-flakey.c
parent7efd5fed6fd713e206ace4b71116d0a5d719fb0a (diff)
downloadlinux-7690e25302dc7d0cd42b349e746fe44b44a94f2b.tar.xz
dm flakey: check for null arg_name in parse_features()
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 <rgoldwyn@suse.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Diffstat (limited to 'drivers/md/dm-flakey.c')
-rw-r--r--drivers/md/dm-flakey.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/md/dm-flakey.c b/drivers/md/dm-flakey.c
index b82cb1ab1eaa..1b907b15f5c3 100644
--- a/drivers/md/dm-flakey.c
+++ b/drivers/md/dm-flakey.c
@@ -70,6 +70,11 @@ static int parse_features(struct dm_arg_set *as, struct flakey_c *fc,
arg_name = dm_shift_arg(as);
argc--;
+ if (!arg_name) {
+ ti->error = "Insufficient feature arguments";
+ return -EINVAL;
+ }
+
/*
* drop_writes
*/