pstore: skip zero size persistent ram buffer in traverse
PATCH 1/1 pstore: skip zero size persistent ram buffer in traverse
From: Liu ShuoX <[email protected]>
In ramoops_pstore_read, a valid prz pointer with zero size buffer will break traverse of all persistent ram buffers. The latter buffer might be lost.
--- fs/pstore/ram.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
fs/pstore/ram.c +5 -5
@@ -119,12 +119,12 @@ ramoops_get_next_prz(struct persistent_ram_zone *przs[], uint *c, uint max, prz = przs[i]; -if (update) { -/* Update old/shadowed buffer. */ +/* Update old/shadowed buffer. */ +if (update)persistent_ram_save_old (prz); -if (!persistent_ram_old_size (prz)) -return NULL ; - } + +if (!persistent_ram_old_size (prz)) +return NULL ; *typep = type; *id = i;
Signature · 1 line
1.8.3.2
Quoted 5 lines · On 2014/2/28 14:38, [email protected] wrote:
From: Liu ShuoX <[email protected]>
In
ramoops_pstore_read, a valid prz pointer with zero size buffer will break traverse of all persistent ram buffers. The latter buffer might be lost.
Andrew,
Would you like to merge it to your testing tree? pstore is a very important feature for debugging hard issues on Android mobiles.
Yanmin
Quoted 28 lines
Signed-off-by Liu ShuoX <[email protected]>--- fs/pstore/ram.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)fs/pstore/ram.c +5
-5@@ -119,12 +119,12 @@ ramoops_get_next_prz(struct persistent_ram_zone *przs[], uint *c, uint max, prz = przs[i]; -if (update) { -/* Update old/shadowed buffer. */ +/* Update old/shadowed buffer. */ +if (update)persistent_ram_save_old (prz); -if (!persistent_ram_old_size (prz)) -return NULL ; - } + +if (!persistent_ram_old_size (prz)) +return NULL ; *typep = type; *id = i;
Quoted 23 lines · On Thu, Feb 27, 2014 at 10:38 PM, <[email protected]> wrote:
From: Liu ShuoX <[email protected]>
In
ramoops_pstore_read, a valid prz pointer with zero size buffer will break traverse of all persistent ram buffers. The latter buffer might be lost.Signed-off-by Liu ShuoX <[email protected]>--- fs/pstore/ram.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)fs/pstore/ram.c +2
-2@@ -119,12 +119,12 @@ ramoops_get_next_prz(struct persistent_ram_zone *przs[], uint *c, uint max, prz = przs[i]; -if (update) { -/* Update old/shadowed buffer. */ +/* Update old/shadowed buffer. */ +if (update)
fs/pstore/ram.c ramoops_get_next_prz(struct persistent_ram_zone *przs[], uint *c, uint max, · line 130
Quoted 10 lines
fs/pstore/ram.c +3
-3persistent_ram_save_old (prz); -if (!persistent_ram_old_size (prz)) -return NULL ; - } + +if (!persistent_ram_old_size (prz)) +return NULL ; *typep = type; *id = i;
Good catch; this change makes sense to me.
-Kees
Signature · 2 lines
Kees Cook Chrome OS Security