Skip to content

Commit

Permalink
Merge tag 'pstore-v5.0-rc4' of git://git.kernel.org/pub/scm/linux/ker…
Browse files Browse the repository at this point in the history
…nel/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
  • Loading branch information
torvalds committed Jan 21, 2019
2 parents dbcfc96 + 5631e85 commit 1e556ba
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions fs/pstore/ram.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ ramoops_get_next_prz(struct persistent_ram_zone *przs[], int id,
struct pstore_record *record)
{
struct persistent_ram_zone *prz;
bool update = (record->type == PSTORE_TYPE_DMESG);

/* Give up if we never existed or have hit the end. */
if (!przs)
Expand All @@ -139,7 +138,7 @@ ramoops_get_next_prz(struct persistent_ram_zone *przs[], int id,
return NULL;

/* Update old/shadowed buffer. */
if (update)
if (prz->type == PSTORE_TYPE_DMESG)
persistent_ram_save_old(prz);

if (!persistent_ram_old_size(prz))
Expand Down Expand Up @@ -711,18 +710,15 @@ static int ramoops_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct ramoops_platform_data *pdata = dev->platform_data;
struct ramoops_platform_data pdata_local;
struct ramoops_context *cxt = &oops_cxt;
size_t dump_mem_sz;
phys_addr_t paddr;
int err = -EINVAL;

if (dev_of_node(dev) && !pdata) {
pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
if (!pdata) {
pr_err("cannot allocate platform data buffer\n");
err = -ENOMEM;
goto fail_out;
}
pdata = &pdata_local;
memset(pdata, 0, sizeof(*pdata));

err = ramoops_parse_dt(pdev, pdata);
if (err < 0)
Expand Down

0 comments on commit 1e556ba

Please sign in to comment.