summaryrefslogtreecommitdiffstats
path: root/fs/pstore
diff options
context:
space:
mode:
authorColin Ian King <colin.king@canonical.com>2012-11-14 11:49:53 +0000
committerAnton Vorontsov <anton.vorontsov@linaro.org>2012-11-14 18:30:21 -0800
commit70a6f46d7b0ec03653b9ab3f8063a9717a4a53ef (patch)
tree9083a77f2a4c97e1658a3db8019f29599a4dd187 /fs/pstore
parent77b67063bb6bce6d475e910d3b886a606d0d91f7 (diff)
downloadlinux-70a6f46d7b0ec03653b9ab3f8063a9717a4a53ef.tar.bz2
pstore: Fix NULL pointer dereference in console writes
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> Cc: stable@vger.kernel.org Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
Diffstat (limited to 'fs/pstore')
-rw-r--r--fs/pstore/platform.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c
index a40da07e93d6..947fbe06c3b1 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;