Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1720309
| From | Sergey Senozhatsky <sergey.senozhatsky@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH] of: do not leak console options |
| Date | 2017-08-25 19:50 +0200 |
| Message-ID | <uiqU2-71g-5@gated-at.bofh.it> (permalink) |
| Organization | linux.* mail to news gateway |
If add_preferred_console() returns error then we must free a
copy of `of_stdout_options' that we create right before the
console registration.
Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
---
drivers/of/base.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/drivers/of/base.c b/drivers/of/base.c
index 260d33c0f26c..9fcf7011d206 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -1779,10 +1779,17 @@ EXPORT_SYMBOL_GPL(of_alias_get_highest_id);
*/
bool of_console_check(struct device_node *dn, char *name, int index)
{
+ bool ret;
+ char *options;
+
if (!dn || dn != of_stdout || console_set_on_cmdline)
return false;
- return !add_preferred_console(name, index,
- kstrdup(of_stdout_options, GFP_KERNEL));
+
+ options = kstrdup(of_stdout_options, GFP_KERNEL);
+ ret = add_preferred_console(name, index, options);
+ if (ret)
+ kfree(options);
+ return !ret;
}
EXPORT_SYMBOL_GPL(of_console_check);
--
2.14.1
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
[PATCH] of: do not leak console options Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2017-08-25 19:50 +0200
Re: [PATCH] of: do not leak console options Rob Herring <robh@kernel.org> - 2017-08-26 00:40 +0200
Re: [PATCH] of: do not leak console options Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2017-08-27 09:30 +0200
Re: [PATCH] of: do not leak console options Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2017-08-27 10:10 +0200
Re: [PATCH] of: do not leak console options Petr Mladek <pmladek@suse.com> - 2017-09-06 14:50 +0200
Re: [PATCH] of: do not leak console options Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2017-09-06 15:40 +0200
Re: [PATCH] of: do not leak console options Rob Herring <robh@kernel.org> - 2017-09-06 17:30 +0200
Re: [PATCH] of: do not leak console options Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2017-09-07 12:10 +0200
csiph-web