pstore bug fixes
- always reset circular buffer state when writing new dump (Aleksandr Yashkin) - fix rare error-path memory leak (Kees Cook) -----BEGIN PGP SIGNATURE----- Comment: Kees Cook <kees@outflux.net> iQJKBAABCgA0FiEEpcP2jyKd1g9yPm4TiXL039xtwCYFAl4OWFsWHGtlZXNjb29r QGNocm9taXVtLm9yZwAKCRCJcvTf3G3AJg3FD/0Vp/Qf0zfjGlV657kNhbYMKYSM h/ItNhFovnRnxobY2CzjZyYoU9ZCsv2bEhplILlJxG84l+nb3nUubHGhUVcoQ6iE aDJAdz632qB+R8l/Ouk0xUp/UnVvoheA68RCaeY6R7G/vAHqceoGD72Ji5kFe1T8 QxPqVAJAIn+hdBHtZVhuueqINQ+3nCUUwE4Yu0veqEG5wcf+awGDjDrha2ZsMyfM Zl54co7l5Z5MwLLTxXO8RRFXlGtmMXnLQcKUwdPIxi+ZBZRan2pdj2zX5Sr0eGA2 HtZchn9Bc5bbwERRobbwWzQeqbwfoRHMOWFq7mUHyaho/5Pbv67A0lOib2cuXG+U WjpXV9nLiAbVqIH0wph4Vppx5acDI7o0JRS0oct/f7trZE58zXfHLJHLqPrblV8J 3pr989yGBEYI8YCf2dJXIKQlT0+s24Iyby0RmkCwQC/DkRWf9+a6BBYLHvGS96Y2 gZ4wKGJRXbDP3m4NuojYRv3DwF71jtSw5bR1kLAdjEygbtxG064mTcACH+DsScKK 6zBbOA2qBf1ReFdz4KVN9TAOnPIsTgeBG5ttmzGgkKZUUAe9+65AJH8jS22NSD2S mn4S2hXio5hV3bMUJtItEzMjYwMkdeyac8EubPlLH4DoNdZ01ER6L07x83m5cPjl wZ845V9VZ14i4bkq8w== =yG+c -----END PGP SIGNATURE----- Merge tag 'pstore-v5.5-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux Pull pstore bug fixes from Kees Cook: - always reset circular buffer state when writing new dump (Aleksandr Yashkin) - fix rare error-path memory leak (Kees Cook) * tag 'pstore-v5.5-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux: pstore/ram: Write new dumps to start of recycled zones pstore/ram: Fix error-path memory leak in persistent_ram_new() callers
This commit is contained in:
commit
278b14eb92
|
@ -407,6 +407,17 @@ static int notrace ramoops_pstore_write(struct pstore_record *record)
|
|||
|
||||
prz = cxt->dprzs[cxt->dump_write_cnt];
|
||||
|
||||
/*
|
||||
* Since this is a new crash dump, we need to reset the buffer in
|
||||
* case it still has an old dump present. Without this, the new dump
|
||||
* will get appended, which would seriously confuse anything trying
|
||||
* to check dump file contents. Specifically, ramoops_read_kmsg_hdr()
|
||||
* expects to find a dump header in the beginning of buffer data, so
|
||||
* we must to reset the buffer values, in order to ensure that the
|
||||
* header will be written to the beginning of the buffer.
|
||||
*/
|
||||
persistent_ram_zap(prz);
|
||||
|
||||
/* Build header and append record contents. */
|
||||
hlen = ramoops_write_kmsg_hdr(prz, record);
|
||||
if (!hlen)
|
||||
|
@ -577,6 +588,7 @@ static int ramoops_init_przs(const char *name,
|
|||
dev_err(dev, "failed to request %s mem region (0x%zx@0x%llx): %d\n",
|
||||
name, record_size,
|
||||
(unsigned long long)*paddr, err);
|
||||
kfree(label);
|
||||
|
||||
while (i > 0) {
|
||||
i--;
|
||||
|
@ -622,6 +634,7 @@ static int ramoops_init_prz(const char *name,
|
|||
|
||||
dev_err(dev, "failed to request %s mem region (0x%zx@0x%llx): %d\n",
|
||||
name, sz, (unsigned long long)*paddr, err);
|
||||
kfree(label);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user