public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Kees Cook <keescook@chromium.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Lidza Louina <lidza.louina@gmail.com>,
	Tushar Behera <tushar.behera@linaro.org>,
	devel@driverdev.osuosl.org
Subject: [PATCH] staging: dgnc: fix potential format string flaw
Date: Tue, 10 Sep 2013 21:41:16 -0700	[thread overview]
Message-ID: <20130911044116.GA17294@www.outflux.net> (raw)

Make sure that format strings cannot leak into printk() calls from the
msgbuf string.

Signed-off-by: Kees Cook <keescook@chromium.org>
---
 drivers/staging/dgnc/dgnc_driver.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_driver.c b/drivers/staging/dgnc/dgnc_driver.c
index f8c1e22..71d2b83 100644
--- a/drivers/staging/dgnc/dgnc_driver.c
+++ b/drivers/staging/dgnc/dgnc_driver.c
@@ -454,7 +454,7 @@ static void dgnc_cleanup_board(struct board_t *brd)
 
 		DGNC_LOCK(dgnc_global_lock, flags);
 		brd->msgbuf = NULL;
-		printk(brd->msgbuf_head);
+		printk("%s", brd->msgbuf_head);
 		kfree(brd->msgbuf_head);
 		brd->msgbuf_head = NULL;
 		DGNC_UNLOCK(dgnc_global_lock, flags);
@@ -710,7 +710,7 @@ static int dgnc_found_board(struct pci_dev *pdev, int id)
 	DPR_INIT(("dgnc_scan(%d) - printing out the msgbuf\n", i));
 	DGNC_LOCK(dgnc_global_lock, flags);
 	brd->msgbuf = NULL;
-	printk(brd->msgbuf_head);
+	printk("%s", brd->msgbuf_head);
 	kfree(brd->msgbuf_head);
 	brd->msgbuf_head = NULL;
 	DGNC_UNLOCK(dgnc_global_lock, flags);
-- 
1.7.9.5


-- 
Kees Cook
Chrome OS Security

             reply	other threads:[~2013-09-11  4:44 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-11  4:41 Kees Cook [this message]
2013-09-11  5:00 ` [PATCH] staging: dgnc: fix potential format string flaw Joe Perches
2013-09-11  5:19   ` Kees Cook
2013-09-11  9:31     ` Dan Carpenter
2013-09-11 18:19       ` Kees Cook
2013-09-11 19:09         ` Joe Perches
2013-09-11 19:25           ` Kees Cook
2013-09-11 19:45             ` Joe Perches
2013-09-11 19:47               ` Kees Cook
2013-09-11 23:22                 ` [RFC PATCH] vsnprintf: Remove use of %n and convert existing uses Joe Perches
2013-09-11 23:29                   ` Kees Cook
2013-09-11 23:43                     ` Joe Perches
2013-09-11 23:40                   ` Tetsuo Handa
2013-09-12  0:04                     ` Joe Perches
2013-09-12  0:19                       ` Al Viro
2013-09-12  0:41                         ` Joe Perches
2013-09-12  8:06                         ` David Laight
2013-09-12 15:59                           ` Joe Perches
2013-09-11 19:28           ` [PATCH] staging: dgnc: fix potential format string flaw Dan Carpenter
2013-09-11 19:22         ` Dan Carpenter
2013-09-11 19:26           ` 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=20130911044116.GA17294@www.outflux.net \
    --to=keescook@chromium.org \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=lidza.louina@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tushar.behera@linaro.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