diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-02-22 02:51:37 +0100 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-02-22 02:51:37 +0100 |
commit | 6d1dd93ea0d0f0fb61b5450a2668896028ce3f75 (patch) | |
tree | a45ab8a949209c0cef6f00b0882e5f39bb5fcb4c /fs | |
parent | Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jik... (diff) | |
parent | MAINTAINERS: Adjust pstore git repo URI, add files (diff) | |
download | linux-6d1dd93ea0d0f0fb61b5450a2668896028ce3f75.tar.xz linux-6d1dd93ea0d0f0fb61b5450a2668896028ce3f75.zip |
Merge tag 'pstore-v4.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux
Pull pstore updates from Kees Cook:
"Minor changes to pstore tree:
- update MAINTAINERS with current git repo, add more files.
- move prz allocation checks into the walker
- initialize flags correctly (by accident spinlock was technically
ok)"
* tag 'pstore-v4.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux:
MAINTAINERS: Adjust pstore git repo URI, add files
pstore: Check for prz allocation in walker
pstore: Correctly initialize spinlock and flags
Diffstat (limited to 'fs')
-rw-r--r-- | fs/pstore/ram.c | 5 | ||||
-rw-r--r-- | fs/pstore/ram_core.c | 12 |
2 files changed, 10 insertions, 7 deletions
diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c index 1d887efaaf71..11f918d34b1e 100644 --- a/fs/pstore/ram.c +++ b/fs/pstore/ram.c @@ -133,7 +133,8 @@ ramoops_get_next_prz(struct persistent_ram_zone *przs[], uint *c, uint max, struct persistent_ram_zone *prz; int i = (*c)++; - if (i >= max) + /* Give up if we never existed or have hit the end. */ + if (!przs || i >= max) return NULL; prz = przs[i]; @@ -280,7 +281,7 @@ static ssize_t ramoops_pstore_read(u64 *id, enum pstore_type_id *type, 1, id, type, PSTORE_TYPE_PMSG, 0); /* ftrace is last since it may want to dynamically allocate memory. */ - if (!prz_ok(prz) && cxt->fprzs) { + if (!prz_ok(prz)) { if (!(cxt->flags & RAMOOPS_FLAG_FTRACE_PER_CPU)) { prz = ramoops_get_next_prz(cxt->fprzs, &cxt->ftrace_read_cnt, 1, id, type, diff --git a/fs/pstore/ram_core.c b/fs/pstore/ram_core.c index a857338b7dab..bc927e30bdcc 100644 --- a/fs/pstore/ram_core.c +++ b/fs/pstore/ram_core.c @@ -467,8 +467,7 @@ static int persistent_ram_buffer_map(phys_addr_t start, phys_addr_t size, } static int persistent_ram_post_init(struct persistent_ram_zone *prz, u32 sig, - struct persistent_ram_ecc_info *ecc_info, - unsigned long flags) + struct persistent_ram_ecc_info *ecc_info) { int ret; @@ -494,10 +493,9 @@ static int persistent_ram_post_init(struct persistent_ram_zone *prz, u32 sig, prz->buffer->sig); } + /* Rewind missing or invalid memory area. */ prz->buffer->sig = sig; persistent_ram_zap(prz); - prz->buffer_lock = __RAW_SPIN_LOCK_UNLOCKED(buffer_lock); - prz->flags = flags; return 0; } @@ -533,11 +531,15 @@ struct persistent_ram_zone *persistent_ram_new(phys_addr_t start, size_t size, goto err; } + /* Initialize general buffer state. */ + prz->buffer_lock = __RAW_SPIN_LOCK_UNLOCKED(buffer_lock); + prz->flags = flags; + ret = persistent_ram_buffer_map(start, size, prz, memtype); if (ret) goto err; - ret = persistent_ram_post_init(prz, sig, ecc_info, flags); + ret = persistent_ram_post_init(prz, sig, ecc_info); if (ret) goto err; |