dm flakey: fix a crash with invalid table line
commit 98dba02d9a
upstream.
This command will crash with NULL pointer dereference:
dmsetup create flakey --table \
"0 `blockdev --getsize /dev/ram0` flakey /dev/ram0 0 0 1 2 corrupt_bio_byte 512"
Fix the crash by checking if arg_name is non-NULL before comparing it.
Cc: stable@vger.kernel.org
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
3877b5c150
commit
cb874a190f
|
@ -124,9 +124,9 @@ static int parse_features(struct dm_arg_set *as, struct flakey_c *fc,
|
|||
* Direction r or w?
|
||||
*/
|
||||
arg_name = dm_shift_arg(as);
|
||||
if (!strcasecmp(arg_name, "w"))
|
||||
if (arg_name && !strcasecmp(arg_name, "w"))
|
||||
fc->corrupt_bio_rw = WRITE;
|
||||
else if (!strcasecmp(arg_name, "r"))
|
||||
else if (arg_name && !strcasecmp(arg_name, "r"))
|
||||
fc->corrupt_bio_rw = READ;
|
||||
else {
|
||||
ti->error = "Invalid corrupt bio direction (r or w)";
|
||||
|
|
Loading…
Reference in New Issue