From: Liu ShuoX Date: Mon, 17 Mar 2014 00:24:49 +0000 (+1100) Subject: pstore: skip zero size persistent ram buffer in traverse X-Git-Tag: v3.15-rc1~92^2~4 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=aa9a4a1edfbd3d223af01db833da2f07850bc655;p=karo-tx-linux.git pstore: skip zero size persistent ram buffer in traverse 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 Cc: "Zhang, Yanmin" Cc: Colin Cross Reviewed-by: Kees Cook Signed-off-by: Andrew Morton Signed-off-by: Tony Luck --- diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c index 9fe5b13295e0..1daed280f1b6 100644 --- a/fs/pstore/ram.c +++ b/fs/pstore/ram.c @@ -120,12 +120,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;