Commit 1e556ba3 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'pstore-v5.0-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux

Pull pstore fixes from Kees Cook:

 - Fix console ramoops to show the previous boot logs (Sai Prakash
   Ranjan)

 - Avoid allocation and leak of platform data

* tag 'pstore-v5.0-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux:
  pstore/ram: Avoid allocation and leak of platform data
  pstore/ram: Fix console ramoops to show the previous boot logs
parents dbcfc961 5631e857
...@@ -128,7 +128,6 @@ ramoops_get_next_prz(struct persistent_ram_zone *przs[], int id, ...@@ -128,7 +128,6 @@ ramoops_get_next_prz(struct persistent_ram_zone *przs[], int id,
struct pstore_record *record) struct pstore_record *record)
{ {
struct persistent_ram_zone *prz; struct persistent_ram_zone *prz;
bool update = (record->type == PSTORE_TYPE_DMESG);
/* Give up if we never existed or have hit the end. */ /* Give up if we never existed or have hit the end. */
if (!przs) if (!przs)
...@@ -139,7 +138,7 @@ ramoops_get_next_prz(struct persistent_ram_zone *przs[], int id, ...@@ -139,7 +138,7 @@ ramoops_get_next_prz(struct persistent_ram_zone *przs[], int id,
return NULL; return NULL;
/* Update old/shadowed buffer. */ /* Update old/shadowed buffer. */
if (update) if (prz->type == PSTORE_TYPE_DMESG)
persistent_ram_save_old(prz); persistent_ram_save_old(prz);
if (!persistent_ram_old_size(prz)) if (!persistent_ram_old_size(prz))
...@@ -711,18 +710,15 @@ static int ramoops_probe(struct platform_device *pdev) ...@@ -711,18 +710,15 @@ static int ramoops_probe(struct platform_device *pdev)
{ {
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct ramoops_platform_data *pdata = dev->platform_data; struct ramoops_platform_data *pdata = dev->platform_data;
struct ramoops_platform_data pdata_local;
struct ramoops_context *cxt = &oops_cxt; struct ramoops_context *cxt = &oops_cxt;
size_t dump_mem_sz; size_t dump_mem_sz;
phys_addr_t paddr; phys_addr_t paddr;
int err = -EINVAL; int err = -EINVAL;
if (dev_of_node(dev) && !pdata) { if (dev_of_node(dev) && !pdata) {
pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); pdata = &pdata_local;
if (!pdata) { memset(pdata, 0, sizeof(*pdata));
pr_err("cannot allocate platform data buffer\n");
err = -ENOMEM;
goto fail_out;
}
err = ramoops_parse_dt(pdev, pdata); err = ramoops_parse_dt(pdev, pdata);
if (err < 0) if (err < 0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment