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]
Date:	Fri, 4 Jul 2014 10:15:52 +0800
From:	Lan Tianyu <lantianyu1986@...il.com>
To:	Colin King <colin.king@...onical.com>
Cc:	"Rafael J. Wysocki" <rjw@...ysocki.net>,
	Len Brown <lenb@...nel.org>,
	"linux-acpi@...r.kernel.org" <linux-acpi@...r.kernel.org>,
	"linux-kernel@...r kernel org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] ACPI / EC: Free saved_ec on error exit path

2014-07-03 7:35 GMT+08:00 Colin King <colin.king@...onical.com>:
> From: Colin Ian King <colin.king@...onical.com>
>
> Smatch detected two memory leaks on saved_ec:
>
> drivers/acpi/ec.c:1070 acpi_ec_ecdt_probe() warn: possible
>   memory leak of 'saved_ec'
> drivers/acpi/ec.c:1109 acpi_ec_ecdt_probe() warn: possible
>   memory leak of 'saved_ec'
>
> Free saved_ec on these two error exit paths to stop the memory
> leak.  Note that saved_ec maybe null, but kfree on null is allowed.
>

Acked-by: Lan Tianyu <tianyu.lan@...el.com>

> Signed-off-by: Colin Ian King <colin.king@...onical.com>
> ---
>  drivers/acpi/ec.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
> index ad11ba4..9800f50 100644
> --- a/drivers/acpi/ec.c
> +++ b/drivers/acpi/ec.c
> @@ -1066,8 +1066,10 @@ int __init acpi_ec_ecdt_probe(void)
>         /* fall through */
>         }
>
> -       if (EC_FLAGS_SKIP_DSDT_SCAN)
> +       if (EC_FLAGS_SKIP_DSDT_SCAN) {
> +               kfree(saved_ec);
>                 return -ENODEV;
> +       }
>
>         /* This workaround is needed only on some broken machines,
>          * which require early EC, but fail to provide ECDT */
> @@ -1105,6 +1107,7 @@ install:
>         }
>  error:
>         kfree(boot_ec);
> +       kfree(saved_ec);
>         boot_ec = NULL;
>         return -ENODEV;
>  }
> --
> 2.0.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



-- 
Best regards
Tianyu Lan
--
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