* [PATCH RESEND] pstore: fix NULL pointer dereference in console writes
@ 2012-11-14 11:49 Colin King
2012-11-15 2:49 ` Anton Vorontsov
0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2012-11-14 11:49 UTC (permalink / raw)
To: Anton Vorontsov, Colin Cross, Tony Luck, Linus Torvalds
Cc: Kees Cook, linux-kernel
From: Colin Ian King <colin.king@canonical.com>
Passing a NULL id causes a NULL pointer deference in writers
such as erst_writer and efi_pstore_write because they expect
to update this id. Pass a dummy id instead.
This avoids a cascade of oopses caused when the initial
pstore_console_write passes a null which in turn causes
writes to the console causing further oopses in subsequent
pstore_console_write calls.
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Kees Cook <keescook@chromium.org>
---
fs/pstore/platform.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c
index a40da07..947fbe0 100644
--- a/fs/pstore/platform.c
+++ b/fs/pstore/platform.c
@@ -161,6 +161,7 @@ static void pstore_console_write(struct console *con, const char *s, unsigned c)
while (s < e) {
unsigned long flags;
+ u64 id;
if (c > psinfo->bufsize)
c = psinfo->bufsize;
@@ -172,7 +173,7 @@ static void pstore_console_write(struct console *con, const char *s, unsigned c)
spin_lock_irqsave(&psinfo->buf_lock, flags);
}
memcpy(psinfo->buf, s, c);
- psinfo->write(PSTORE_TYPE_CONSOLE, 0, NULL, 0, c, psinfo);
+ psinfo->write(PSTORE_TYPE_CONSOLE, 0, &id, 0, c, psinfo);
spin_unlock_irqrestore(&psinfo->buf_lock, flags);
s += c;
c = e - s;
--
1.7.10.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH RESEND] pstore: fix NULL pointer dereference in console writes
2012-11-14 11:49 [PATCH RESEND] pstore: fix NULL pointer dereference in console writes Colin King
@ 2012-11-15 2:49 ` Anton Vorontsov
0 siblings, 0 replies; 2+ messages in thread
From: Anton Vorontsov @ 2012-11-15 2:49 UTC (permalink / raw)
To: Colin King
Cc: Colin Cross, Tony Luck, Linus Torvalds, Kees Cook, linux-kernel
On Wed, Nov 14, 2012 at 11:49:53AM +0000, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Passing a NULL id causes a NULL pointer deference in writers
> such as erst_writer and efi_pstore_write because they expect
> to update this id. Pass a dummy id instead.
>
> This avoids a cascade of oopses caused when the initial
> pstore_console_write passes a null which in turn causes
> writes to the console causing further oopses in subsequent
> pstore_console_write calls.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> Acked-by: Kees Cook <keescook@chromium.org>
> ---
Ugh. Thanks for the reminder, I completely forgot that I had this bit for
v3.7.
Applied, thanks! (I also added Cc: stable.)
> fs/pstore/platform.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c
> index a40da07..947fbe0 100644
> --- a/fs/pstore/platform.c
> +++ b/fs/pstore/platform.c
> @@ -161,6 +161,7 @@ static void pstore_console_write(struct console *con, const char *s, unsigned c)
>
> while (s < e) {
> unsigned long flags;
> + u64 id;
>
> if (c > psinfo->bufsize)
> c = psinfo->bufsize;
> @@ -172,7 +173,7 @@ static void pstore_console_write(struct console *con, const char *s, unsigned c)
> spin_lock_irqsave(&psinfo->buf_lock, flags);
> }
> memcpy(psinfo->buf, s, c);
> - psinfo->write(PSTORE_TYPE_CONSOLE, 0, NULL, 0, c, psinfo);
> + psinfo->write(PSTORE_TYPE_CONSOLE, 0, &id, 0, c, psinfo);
> spin_unlock_irqrestore(&psinfo->buf_lock, flags);
> s += c;
> c = e - s;
> --
> 1.7.10.4
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-11-15 2:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-14 11:49 [PATCH RESEND] pstore: fix NULL pointer dereference in console writes Colin King
2012-11-15 2:49 ` Anton Vorontsov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox