dm flakey: fix a crash with invalid table line
authorMikulas Patocka <mpatocka@redhat.com>
Tue, 18 Apr 2023 19:57:47 +0000 (15:57 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 11 May 2023 14:03:41 +0000 (23:03 +0900)
commitcb874a190f3f7c3c3fa5b979bee7a3b8cc3a19cc
treebdca0edb71a3e6cb0221c9f218937e00e6192b14
parent3877b5c1509b16eeb1f275228fd91789cd88cf17
dm flakey: fix a crash with invalid table line

commit 98dba02d9a93eec11bffbb93c7c51624290702d2 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>
drivers/md/dm-flakey.c