From: Kees Cook <keescook@chromium.org>
To: linux-kernel@vger.kernel.org
Cc: Andrew Morton <akpm@linux-foundation.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jens Axboe <axboe@kernel.dk>,
"David S. Miller" <davem@davemloft.net>,
Herbert Xu <herbert@gondor.hengli.com.au>,
David Woodhouse <dwmw2@infradead.org>,
Anton Vorontsov <cbou@mail.ru>,
Karsten Keil <isdn@linux-pingi.de>,
Kees Cook <keescook@chromium.org>
Subject: [PATCH 2/8] kobject: sanitize argument for format string
Date: Thu, 6 Jun 2013 13:52:19 -0700 [thread overview]
Message-ID: <1370551945-8444-3-git-send-email-keescook@chromium.org> (raw)
In-Reply-To: <1370551945-8444-1-git-send-email-keescook@chromium.org>
Unlike kobject_set_name(), the kset_create_and_add() interface does not
provide a way to use format strings, so make sure that the interface
cannot be abused accidentally. It looks like all current callers use
static strings, so there's no existing flaw.
Signed-off-by: Kees Cook <keescook@chromium.org>
---
lib/kobject.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/kobject.c b/lib/kobject.c
index b7e29a6..4a1f33d 100644
--- a/lib/kobject.c
+++ b/lib/kobject.c
@@ -805,7 +805,7 @@ static struct kset *kset_create(const char *name,
kset = kzalloc(sizeof(*kset), GFP_KERNEL);
if (!kset)
return NULL;
- retval = kobject_set_name(&kset->kobj, name);
+ retval = kobject_set_name(&kset->kobj, "%s", name);
if (retval) {
kfree(kset);
return NULL;
--
1.7.9.5
next prev parent reply other threads:[~2013-06-06 20:54 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-06 20:52 [PATCH 0/8] format string usage clean ups Kees Cook
2013-06-06 20:52 ` [PATCH 1/8] block: do not pass disk names as format strings Kees Cook
2013-06-06 20:52 ` Kees Cook [this message]
2013-06-06 20:52 ` [PATCH 3/8] crypto: sanitize argument for format string Kees Cook
2013-06-06 20:52 ` [PATCH 4/8] power: ensure event is not used as " Kees Cook
2013-06-07 0:39 ` Anton Vorontsov
2013-06-07 1:25 ` [PATCH] power: Add missing newlines, fix a couple of typos, add pr_fmt Joe Perches
2013-06-07 18:31 ` Kees Cook
2013-06-09 17:10 ` Anton Vorontsov
2013-06-06 20:52 ` [PATCH 5/8] device: avoid format string in dev_set_name Kees Cook
2013-06-07 23:10 ` Greg Kroah-Hartman
2013-06-06 20:52 ` [PATCH 6/8] workqueue: avoid format strings in names Kees Cook
2013-06-06 20:52 ` [PATCH 7/8] kthread: avoid parsing names as format strings Kees Cook
2013-06-06 20:52 ` [PATCH 8/8] isdn: clean up debug format string usage Kees Cook
2013-06-07 18:32 ` Kees Cook
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1370551945-8444-3-git-send-email-keescook@chromium.org \
--to=keescook@chromium.org \
--cc=akpm@linux-foundation.org \
--cc=axboe@kernel.dk \
--cc=cbou@mail.ru \
--cc=davem@davemloft.net \
--cc=dwmw2@infradead.org \
--cc=gregkh@linuxfoundation.org \
--cc=herbert@gondor.hengli.com.au \
--cc=isdn@linux-pingi.de \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®