aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/fs/pstore/platform.c
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2020-05-04 19:43:41 -0700
committerKees Cook <keescook@chromium.org>2020-05-30 10:33:46 -0700
commit27e5041a87e8af2d0b6452dffe053d0253e914cc (patch)
tree4459a9c30b757756971ffcf26e68f2ccdee6c722 /fs/pstore/platform.c
parentpstore: Refactor pstorefs record list removal (diff)
downloadwireguard-linux-27e5041a87e8af2d0b6452dffe053d0253e914cc.tar.xz
wireguard-linux-27e5041a87e8af2d0b6452dffe053d0253e914cc.zip
pstore: Add locking around superblock changes
Nothing was protecting changes to the pstorefs superblock. Add locking and refactor away is_pstore_mounted(), instead using a helper to add a way to safely lock the pstorefs root inode during filesystem changes. Link: https://lore.kernel.org/lkml/20200506152114.50375-9-keescook@chromium.org/ Signed-off-by: Kees Cook <keescook@chromium.org>
Diffstat (limited to '')
-rw-r--r--fs/pstore/platform.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c
index 8c0076a1f896..624e100fbeca 100644
--- a/fs/pstore/platform.c
+++ b/fs/pstore/platform.c
@@ -460,7 +460,7 @@ static void pstore_dump(struct kmsg_dumper *dumper,
}
ret = psinfo->write(&record);
- if (ret == 0 && reason == KMSG_DUMP_OOPS && pstore_is_mounted())
+ if (ret == 0 && reason == KMSG_DUMP_OOPS)
pstore_new_entry = 1;
total += record.size;
@@ -592,8 +592,7 @@ int pstore_register(struct pstore_info *psi)
if (psi->flags & PSTORE_FLAGS_DMESG)
allocate_buf_for_compression();
- if (pstore_is_mounted())
- pstore_get_records(0);
+ pstore_get_records(0);
if (psi->flags & PSTORE_FLAGS_DMESG)
pstore_register_kmsg();