2016-11-05 02:16:31

by Pengcheng Li

[permalink] [raw]
Subject: [PATCH] pstore/dump: solution pstore data abort.

If not return,data abort will happen
when two threads call pstore_dump at the same time.

Signed-off-by: Liu Hailong <[email protected]>
Signed-off-by: Li Pengcheng <[email protected]>
Signed-off-by: Li Zhong <[email protected]>
---
fs/pstore/platform.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c
index 14984d9..60e6db6 100644
--- a/fs/pstore/platform.c
+++ b/fs/pstore/platform.c
@@ -493,6 +493,7 @@ static void pstore_dump(struct kmsg_dumper *dumper,
if (!is_locked) {
pr_err("pstore dump routine blocked in %s path, may corrupt error record\n"
, in_nmi() ? "NMI" : why);
+ return;
}
} else {
spin_lock_irqsave(&psinfo->buf_lock, flags);
--
1.9.1


2016-11-09 00:44:31

by Kees Cook

[permalink] [raw]
Subject: Re: [PATCH] pstore/dump: solution pstore data abort.

On Fri, Nov 4, 2016 at 7:15 PM, Li Pengcheng <[email protected]> wrote:
> If not return,data abort will happen
> when two threads call pstore_dump at the same time.
>
> Signed-off-by: Liu Hailong <[email protected]>
> Signed-off-by: Li Pengcheng <[email protected]>
> Signed-off-by: Li Zhong <[email protected]>
> ---
> fs/pstore/platform.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c
> index 14984d9..60e6db6 100644
> --- a/fs/pstore/platform.c
> +++ b/fs/pstore/platform.c
> @@ -493,6 +493,7 @@ static void pstore_dump(struct kmsg_dumper *dumper,
> if (!is_locked) {
> pr_err("pstore dump routine blocked in %s path, may corrupt error record\n"
> , in_nmi() ? "NMI" : why);
> + return;
> }
> } else {
> spin_lock_irqsave(&psinfo->buf_lock, flags);
> --
> 1.9.1

Ah, thanks! I've queued this for -next.

-Kees

--
Kees Cook
Nexus Security