diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2026-10-22 14:45:56 -1000 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2026-10-22 14:45:56 -1000 |
| commit | 075e3396ebf5dfd0030bfe12642fa82cecd0c6ee (patch) | |
| tree | 24b207306f24350761a0bfec7cb5914c6e875917 /fs | |
| parent | 3ac032ef6ca8e47bb06d1e189dfcf88fa0a09c75 (diff) | |
| parent | 7c756181175d50200be487affa905e973f6cbaf5 (diff) | |
| download | linux-075e3396ebf5dfd0030bfe12642fa82cecd0c6ee.tar.gz linux-075e3396ebf5dfd0030bfe12642fa82cecd0c6ee.zip | |
Merge tag 'pstore-v7.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux
Pull pstore updates from Kees Cook:
- don't leave an ERR_PTR in the ramoops zone pointer (Andrea Parri)
- reject persistent RAM zones too small for the buffer header (Andrea Parri)
- publish big_oops_buf after max_compressed_size (Jaidev Shastri)
* tag 'pstore-v7.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux:
pstore: publish big_oops_buf after max_compressed_size
pstore: reject persistent RAM zones too small for the buffer header
pstore: don't leave an ERR_PTR in the ramoops zone pointer
Diffstat (limited to 'fs')
| -rw-r--r-- | fs/pstore/platform.c | 12 | ||||
| -rw-r--r-- | fs/pstore/ram.c | 1 | ||||
| -rw-r--r-- | fs/pstore/ram_core.c | 6 |
3 files changed, 16 insertions, 3 deletions
diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c index 1d76c9d92056..1ad6e40f4952 100644 --- a/fs/pstore/platform.c +++ b/fs/pstore/platform.c @@ -240,9 +240,14 @@ static void allocate_buf_for_compression(void) return; } - /* A non-NULL big_oops_buf indicates compression is available. */ - big_oops_buf = buf; max_compressed_size = compressed_size; + /* + * A non-NULL big_oops_buf indicates compression is available. + * pstore_dump() tests it without psinfo_lock and then reads + * max_compressed_size, which is stored above. Publish the buffer + * with release semantics. + */ + smp_store_release(&big_oops_buf, buf); pr_info("Using crash dump compression: %s\n", compress); } @@ -316,7 +321,8 @@ static void pstore_dump(struct kmsg_dumper *dumper, record.part = part; record.buf = psinfo->buf; - dst = big_oops_buf ?: psinfo->buf; + /* Pairs with the smp_store_release() in allocate_buf_for_compression(). */ + dst = smp_load_acquire(&big_oops_buf) ?: psinfo->buf; dst_size = max_compressed_size ?: psinfo->bufsize; /* Write dump header. */ diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c index 2eb0d4fa2186..aa056d0395a4 100644 --- a/fs/pstore/ram.c +++ b/fs/pstore/ram.c @@ -604,6 +604,7 @@ static int ramoops_init_prz(const char *name, if (IS_ERR(*prz)) { int err = PTR_ERR(*prz); + *prz = NULL; dev_err(dev, "failed to request %s mem region (0x%zx@0x%llx): %d\n", name, sz, (unsigned long long)*paddr, err); return err; diff --git a/fs/pstore/ram_core.c b/fs/pstore/ram_core.c index b4ec8009b8dc..ae941777037b 100644 --- a/fs/pstore/ram_core.c +++ b/fs/pstore/ram_core.c @@ -505,6 +505,12 @@ static int persistent_ram_buffer_map(phys_addr_t start, phys_addr_t size, prz->paddr = start; prz->size = size; + if (size <= sizeof(struct persistent_ram_buffer)) { + pr_err("%s: persistent ram zone too small (%#llx bytes)\n", + prz->label, (unsigned long long)size); + return -EINVAL; + } + if (pfn_valid(start >> PAGE_SHIFT)) prz->vaddr = persistent_ram_vmap(start, size, memtype); else |
