Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 98e44fda authored by Namhyung Kim's avatar Namhyung Kim Committed by Kees Cook
Browse files

pstore: Enable compression on normal path (again)



The commit f0e2efcf ("pstore: do not use message compression
without lock") added a check to 'is_locked' to avoid breakage in
concurrent accesses.  But it has a side-effect of disabling compression
on normal path since 'is_locked' variable is not set.  As normal path
always takes the lock, it should be initialized to 1.

This also makes the unlock code a bit simpler.

Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
Signed-off-by: default avatarKees Cook <keescook@chromium.org>
parent a1db8060
Loading
Loading
Loading
Loading
+5 −6
Original line number Diff line number Diff line
@@ -284,7 +284,7 @@ static void pstore_dump(struct kmsg_dumper *dumper,
	u64		id;
	unsigned int	part = 1;
	unsigned long	flags = 0;
	int		is_locked = 0;
	int		is_locked;
	int		ret;

	why = get_reason_str(reason);
@@ -295,8 +295,10 @@ static void pstore_dump(struct kmsg_dumper *dumper,
			pr_err("pstore dump routine blocked in %s path, may corrupt error record\n"
				       , in_nmi() ? "NMI" : why);
		}
	} else
	} else {
		spin_lock_irqsave(&psinfo->buf_lock, flags);
		is_locked = 1;
	}
	oopscount++;
	while (total < kmsg_bytes) {
		char *dst;
@@ -350,11 +352,8 @@ static void pstore_dump(struct kmsg_dumper *dumper,
		total += total_len;
		part++;
	}
	if (pstore_cannot_block_path(reason)) {
	if (is_locked)
		spin_unlock_irqrestore(&psinfo->buf_lock, flags);
	} else
		spin_unlock_irqrestore(&psinfo->buf_lock, flags);
}

static struct kmsg_dumper pstore_dumper = {