* [PATCH] of: avoid format string parsing in kobject names
@ 2014-06-10 16:57 Kees Cook
2014-06-13 14:55 ` Rob Herring
0 siblings, 1 reply; 3+ messages in thread
From: Kees Cook @ 2014-06-10 16:57 UTC (permalink / raw)
To: linux-kernel; +Cc: Grant Likely, Rob Herring, devicetree
This makes sure a format string cannot leak into the kobject name that
is constructed. (And splits the >80 character line.)
Signed-off-by: Kees Cook <keescook@chromium.org>
---
drivers/of/base.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/of/base.c b/drivers/of/base.c
index 8368d96ae7b4..f27d922eaece 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -227,7 +227,8 @@ static int __of_node_add(struct device_node *np)
np->kobj.kset = of_kset;
if (!np->parent) {
/* Nodes without parents are new top level trees */
- rc = kobject_add(&np->kobj, NULL, safe_name(&of_kset->kobj, "base"));
+ rc = kobject_add(&np->kobj, NULL, "%s",
+ safe_name(&of_kset->kobj, "base"));
} else {
name = safe_name(&np->parent->kobj, kbasename(np->full_name));
if (!name || !name[0])
--
1.7.9.5
--
Kees Cook
Chrome OS Security
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] of: avoid format string parsing in kobject names
2014-06-10 16:57 [PATCH] of: avoid format string parsing in kobject names Kees Cook
@ 2014-06-13 14:55 ` Rob Herring
2014-06-13 17:30 ` Kees Cook
0 siblings, 1 reply; 3+ messages in thread
From: Rob Herring @ 2014-06-13 14:55 UTC (permalink / raw)
To: Kees Cook; +Cc: linux-kernel, Grant Likely, Rob Herring, devicetree
On Tue, Jun 10, 2014 at 11:57 AM, Kees Cook <keescook@chromium.org> wrote:
> This makes sure a format string cannot leak into the kobject name that
> is constructed. (And splits the >80 character line.)
>
> Signed-off-by: Kees Cook <keescook@chromium.org>
Applied.
This seems like a non-obvious thing to do, but I guess most people
aren't dealing directly with kobjects.
Rob
> ---
> drivers/of/base.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/of/base.c b/drivers/of/base.c
> index 8368d96ae7b4..f27d922eaece 100644
> --- a/drivers/of/base.c
> +++ b/drivers/of/base.c
> @@ -227,7 +227,8 @@ static int __of_node_add(struct device_node *np)
> np->kobj.kset = of_kset;
> if (!np->parent) {
> /* Nodes without parents are new top level trees */
> - rc = kobject_add(&np->kobj, NULL, safe_name(&of_kset->kobj, "base"));
> + rc = kobject_add(&np->kobj, NULL, "%s",
> + safe_name(&of_kset->kobj, "base"));
> } else {
> name = safe_name(&np->parent->kobj, kbasename(np->full_name));
> if (!name || !name[0])
> --
> 1.7.9.5
>
>
> --
> Kees Cook
> Chrome OS Security
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] of: avoid format string parsing in kobject names
2014-06-13 14:55 ` Rob Herring
@ 2014-06-13 17:30 ` Kees Cook
0 siblings, 0 replies; 3+ messages in thread
From: Kees Cook @ 2014-06-13 17:30 UTC (permalink / raw)
To: Rob Herring; +Cc: linux-kernel, Grant Likely, Rob Herring, devicetree
On Fri, Jun 13, 2014 at 7:55 AM, Rob Herring <robherring2@gmail.com> wrote:
> On Tue, Jun 10, 2014 at 11:57 AM, Kees Cook <keescook@chromium.org> wrote:
>> This makes sure a format string cannot leak into the kobject name that
>> is constructed. (And splits the >80 character line.)
>>
>> Signed-off-by: Kees Cook <keescook@chromium.org>
>
> Applied.
>
> This seems like a non-obvious thing to do, but I guess most people
> aren't dealing directly with kobjects.
Yeah, it's really unlikely this could get reached, but I just keep
cleaning this up any time I see them just to be safe. :)
Thanks!
-Kees
--
Kees Cook
Chrome OS Security
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-06-13 17:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-10 16:57 [PATCH] of: avoid format string parsing in kobject names Kees Cook
2014-06-13 14:55 ` Rob Herring
2014-06-13 17:30 ` Kees Cook
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.