Commit 14f34e9e authored by Douglas Anderson's avatar Douglas Anderson Committed by Greg Kroah-Hartman

pstore: Fix leaked pstore_record in pstore_get_backend_records()

commit f6525b96 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: 2a2b0acf ("pstore: Allocate records on heap instead of stack")
Signed-off-by: default avatarDouglas Anderson <dianders@chromium.org>
Signed-off-by: default avatarKees Cook <keescook@chromium.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent a8f82d6e
......@@ -846,8 +846,10 @@ void pstore_get_backend_records(struct pstore_info *psi,
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);
......
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