Skip to contentSkip to conversation

Patch "pstore: Fix leaked pstore_record in pstore_get_backend_records()" has been added to the 4.12-stable tree

PATCH [email protected] 1 participant 1 message Jul 19, 2017

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

pstore: Fix leaked pstore_record in pstore_get_backend_records()

to the 4.12-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
pstore-fix-leaked-pstore_record-in-pstore_get_backend_records.patch
and it can be found in the queue-4.12 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From f6525b96dd9f68efe374e5aef864975e628de991 Mon Sep 17 00:00:00 2001

From: Douglas Anderson <[email protected]>
Date: Tue, 30 May 2017 15:50:38 -0700
Subject: pstore: Fix leaked pstore_record in pstore_get_backend_records()

From: Douglas Anderson <[email protected]>

commit f6525b96dd9f68efe374e5aef864975e628de991 upstream.

When the "if (record->size <= 0)" test is true in pstore_get_backend_records() it's pretty clear that nobody holds a reference to the allocated pstore_record, yet we don't free it.

Let's free it.

Fixes 2a2b0acf768c ("pstore: Allocate records on heap instead of stack")
---
 fs/pstore/platform.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
fs/pstore/platform.c +3 -1
@@ -846,8 +846,10 @@ void pstore_get_backend_records(struct p
 		record->size = psi->read(record);
 
 		/* No more records left in backend? */
-		if (record->size <= 0)
+		if (record->size <= 0) {
+			kfree(record);
 			break;
+		}
 
 		decompress_record(record);
 		rc = pstore_mkfile(root, record);

Patches currently in stable-queue which might be from [email protected] are

queue-4.12/pstore-fix-leaked-pstore_record-in-pstore_get_backend_records.patch