lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1368642071.5673.37.camel@misato.fc.hp.com>
Date:	Wed, 15 May 2013 12:21:11 -0600
From:	Toshi Kani <toshi.kani@...com>
To:	Catalin Marinas <catalin.marinas@....com>
Cc:	Len Brown <lenb@...nel.org>, "Rafael J. Wysocki" <rjw@...k.pl>,
	linux-acpi@...r.kernel.org, linux-kernel@...r.kernel.org,
	Larry Finger <Larry.Finger@...inger.net>
Subject: Re: [PATCH] acpi: Fix memory leak on acpi_scan_init_hotplug() error
 path

On Wed, 2013-05-15 at 17:49 +0100, Catalin Marinas wrote:
> Following commit 6b772e8f9 (ACPI: Update PNPID match handling for
> notify), the acpi_scan_init_hotplug() calls acpi_set_pnp_ids() which
> allocates acpi_hardware_id and copies a few strings (kstrdup). If the
> devices does not have hardware_id set, the function exits without
> freeing the previously allocated ids (and kmemleak complains). This
> patch calls simply changes 'return' on error to a 'goto out' which calls
> acpi_free_pnp_ids().
> 
> Signed-off-by: Catalin Marinas <catalin.marinas@....com>
> Reported-by: Larry Finger <Larry.Finger@...inger.net>
> Cc: Toshi Kani <toshi.kani@...com>

Reviewed-by: Toshi Kani <toshi.kani@...com>
Tested-by: Toshi Kani <toshi.kani@...com>

Testing was performed by adding a fake ACPI object with _UID only.

Thanks,
-Toshi

> ---
>  drivers/acpi/scan.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
> index fe158fd..c1bc608 100644
> --- a/drivers/acpi/scan.c
> +++ b/drivers/acpi/scan.c
> @@ -1785,7 +1785,7 @@ static void acpi_scan_init_hotplug(acpi_handle handle, int type)
>  	acpi_set_pnp_ids(handle, &pnp, type);
>  
>  	if (!pnp.type.hardware_id)
> -		return;
> +		goto out;
>  
>  	/*
>  	 * This relies on the fact that acpi_install_notify_handler() will not
> @@ -1800,6 +1800,7 @@ static void acpi_scan_init_hotplug(acpi_handle handle, int type)
>  		}
>  	}
>  
> +out:
>  	acpi_free_pnp_ids(&pnp);
>  }
>  


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ