Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Device-mapper Development (http://www.linux-archive.org/device-mapper-development/)
-   -   drivers/md/dm-ioctl.c::target_message(): don't leak 'argv' mem (http://www.linux-archive.org/device-mapper-development/621273-drivers-md-dm-ioctl-c-target_message-dont-leak-argv-mem.html)

Jesper Juhl 01-15-2012 06:36 PM

drivers/md/dm-ioctl.c::target_message(): don't leak 'argv' mem
 
If, after allocating memory for 'argv' via dm_split_args(...), we take
the true branch of 'if (!argc)', we'll jump to the 'out:' label and
neglect to free the memory we allocated. We should instead jump to the
'out_argv:' label in that case as far as I can tell.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
---
drivers/md/dm-ioctl.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

Compile tested only.

diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c
index 31c2dc2..1ce84ed 100644
--- a/drivers/md/dm-ioctl.c
+++ b/drivers/md/dm-ioctl.c
@@ -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);
--
1.7.8.3


--
Jesper Juhl <jj@chaosbits.net> http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel

Mikulas Patocka 01-15-2012 09:28 PM

drivers/md/dm-ioctl.c::target_message(): don't leak 'argv' mem
 
Acked-by: Mikulas Patocka <mpatocka@redhat.com>

BTW., it should be also backported to RHEL-6.

Mikulas

On Sun, 15 Jan 2012, Jesper Juhl wrote:

> If, after allocating memory for 'argv' via dm_split_args(...), we take
> the true branch of 'if (!argc)', we'll jump to the 'out:' label and
> neglect to free the memory we allocated. We should instead jump to the
> 'out_argv:' label in that case as far as I can tell.
>
> Signed-off-by: Jesper Juhl <jj@chaosbits.net>
> ---
> drivers/md/dm-ioctl.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> Compile tested only.
>
> diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c
> index 31c2dc2..1ce84ed 100644
> --- a/drivers/md/dm-ioctl.c
> +++ b/drivers/md/dm-ioctl.c
> @@ -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);
> --
> 1.7.8.3
>
>
> --
> Jesper Juhl <jj@chaosbits.net> http://www.chaosbits.net/
> Don't top-post http://www.catb.org/jargon/html/T/top-post.html
> Plain text mails only, please.
>
> --
> dm-devel mailing list
> dm-devel@redhat.com
> https://www.redhat.com/mailman/listinfo/dm-devel
>

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel


All times are GMT. The time now is 07:16 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.