summaryrefslogtreecommitdiffstats
path: root/vmcore-dmesg
diff options
context:
space:
mode:
authorOmar Sandoval <osandov@fb.com>2018-05-23 13:59:31 -0700
committerSimon Horman <horms@verge.net.au>2018-05-25 11:57:29 +0200
commite277fa9ec702fea7bd3135393c67327c821d5a3a (patch)
treeb1087fa1a8793aee6626ab953ec4c2d12052f6b7 /vmcore-dmesg
parentd4a948c268272cf37c71be820fb02bf40e56292b (diff)
downloadkexec-tools-e277fa9ec702fea7bd3135393c67327c821d5a3a.tar.gz
vmcore-dmesg: fix infinite loop if log buffer wraps around
We hit a bug where vmcore-dmesg would get stuck in a loop, and since we were redirecting the output to a file, it wouldn't stop until it filled up the disk. This only happened when the dmesg buffer had filled up and wrapped around. It turns out that when we hit the end of the buffer, we are looping back to the first record instead of the beginning of the buffer, which will always loop forever. Fixes: e08d26b3b7f1 ("vmcore-dmesg: avoid allocating large memory chunk for log buf") Signed-off-by: Omar Sandoval <osandov@fb.com> Acked-by: Baoquan He <bhe@redhat.com> Signed-off-by: Simon Horman <horms@verge.net.au>
Diffstat (limited to 'vmcore-dmesg')
-rw-r--r--vmcore-dmesg/vmcore-dmesg.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/vmcore-dmesg/vmcore-dmesg.c b/vmcore-dmesg/vmcore-dmesg.c
index e340ef4f..79727889 100644
--- a/vmcore-dmesg/vmcore-dmesg.c
+++ b/vmcore-dmesg/vmcore-dmesg.c
@@ -689,7 +689,7 @@ static void dump_dmesg_structured(int fd)
*/
loglen = struct_val_u16(buf, log_offset_len);
if (!loglen)
- current_idx = log_first_idx;
+ current_idx = 0;
else
/* Move to next record */
current_idx += loglen;