From: Goldwyn Rodrigues Date: Mon, 4 Dec 2017 03:14:12 +0000 (-0600) Subject: dm flakey: check for null arg_name in parse_features() X-Git-Tag: v3.16.83~189 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=30f2093f85b5eab51c3956969c2d2fce68e5e165;p=thirdparty%2Fkernel%2Fstable.git dm flakey: check for null arg_name in parse_features() commit 7690e25302dc7d0cd42b349e746fe44b44a94f2b upstream. 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 Signed-off-by: Mike Snitzer Signed-off-by: Ben Hutchings --- diff --git a/drivers/md/dm-flakey.c b/drivers/md/dm-flakey.c index 3087adb25ab7e..8809c5e6f6ac3 100644 --- a/drivers/md/dm-flakey.c +++ b/drivers/md/dm-flakey.c @@ -69,6 +69,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 */