Skip to content

Commit 1e556ba

Browse files
committed
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
2 parents dbcfc96 + 5631e85 commit 1e556ba

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

fs/pstore/ram.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@ ramoops_get_next_prz(struct persistent_ram_zone *przs[], int id,
128128
struct pstore_record *record)
129129
{
130130
struct persistent_ram_zone *prz;
131-
bool update = (record->type == PSTORE_TYPE_DMESG);
132131

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

141140
/* Update old/shadowed buffer. */
142-
if (update)
141+
if (prz->type == PSTORE_TYPE_DMESG)
143142
persistent_ram_save_old(prz);
144143

145144
if (!persistent_ram_old_size(prz))
@@ -711,18 +710,15 @@ static int ramoops_probe(struct platform_device *pdev)
711710
{
712711
struct device *dev = &pdev->dev;
713712
struct ramoops_platform_data *pdata = dev->platform_data;
713+
struct ramoops_platform_data pdata_local;
714714
struct ramoops_context *cxt = &oops_cxt;
715715
size_t dump_mem_sz;
716716
phys_addr_t paddr;
717717
int err = -EINVAL;
718718

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

727723
err = ramoops_parse_dt(pdev, pdata);
728724
if (err < 0)

0 commit comments

Comments
 (0)