]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
dm ioctl: do not leak argv if target message only contains whitespace
authorJesper Juhl <jj@chaosbits.net>
Wed, 7 Mar 2012 19:09:34 +0000 (19:09 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 12 Mar 2012 19:31:41 +0000 (12:31 -0700)
commit 902c6a96a7cb9c50d2a8aed1788efad0a5d8f04c upstream.

If 'argc' is zero we jump to the 'out:' label, but this leaks the
(unused) memory that 'dm_split_args()' allocated for 'argv' if the
string being split consisted entirely of whitespace.  Jump to the
'out_argv:' label instead to free up that memory.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/md/dm-ioctl.c

index 31c2dc25886d985467e7f4084c96d35a98858f67..1ce84ed0b765a889b74b94674da2aff4ffe0fd1c 100644 (file)
@@ -1437,7 +1437,7 @@ static int target_message(struct dm_ioctl *param, size_t param_size)
 
        if (!argc) {
                DMWARN("Empty message received.");
-               goto out;
+               goto out_argv;
        }
 
        table = dm_get_live_table(md);