* [PATCH] ACPI / EC: Free saved_ec on error exit path
@ 2014-07-02 23:35 Colin King
2014-07-04 2:15 ` Lan Tianyu
0 siblings, 1 reply; 3+ messages in thread
From: Colin King @ 2014-07-02 23:35 UTC (permalink / raw)
To: Rafael J. Wysocki, Len Brown, linux-acpi; +Cc: linux-kernel
From: Colin Ian King <colin.king@canonical.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.
Signed-off-by: Colin Ian King <colin.king@canonical.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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] ACPI / EC: Free saved_ec on error exit path
2014-07-02 23:35 [PATCH] ACPI / EC: Free saved_ec on error exit path Colin King
@ 2014-07-04 2:15 ` Lan Tianyu
2014-07-07 21:00 ` Rafael J. Wysocki
0 siblings, 1 reply; 3+ messages in thread
From: Lan Tianyu @ 2014-07-04 2:15 UTC (permalink / raw)
To: Colin King
Cc: Rafael J. Wysocki, Len Brown, linux-acpi, linux-kernel@vger kernel org
2014-07-03 7:35 GMT+08:00 Colin King <colin.king@canonical.com>:
> From: Colin Ian King <colin.king@canonical.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@intel.com>
> Signed-off-by: Colin Ian King <colin.king@canonical.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@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Best regards
Tianyu Lan
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ACPI / EC: Free saved_ec on error exit path
2014-07-04 2:15 ` Lan Tianyu
@ 2014-07-07 21:00 ` Rafael J. Wysocki
0 siblings, 0 replies; 3+ messages in thread
From: Rafael J. Wysocki @ 2014-07-07 21:00 UTC (permalink / raw)
To: Lan Tianyu
Cc: Colin King, Len Brown, linux-acpi, linux-kernel@vger kernel org
On Friday, July 04, 2014 10:15:52 AM Lan Tianyu wrote:
> 2014-07-03 7:35 GMT+08:00 Colin King <colin.king@canonical.com>:
> > From: Colin Ian King <colin.king@canonical.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@intel.com>
Queued up for 3.16, thanks!
> > Signed-off-by: Colin Ian King <colin.king@canonical.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@vger.kernel.org
> > More majordomo info at http://vger.kernel.org/majordomo-info.html
>
>
>
>
--
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-07-07 20:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-02 23:35 [PATCH] ACPI / EC: Free saved_ec on error exit path Colin King
2014-07-04 2:15 ` Lan Tianyu
2014-07-07 21:00 ` Rafael J. Wysocki
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.