[PATCH 5/7] eval_map_next should increase position index

From: Vasily Averin
Date: Fri Jan 24 2020 - 02:03:39 EST


if seq_file .next fuction does not change position index,
read after some lseek can generate unexpected output.

https://bugzilla.kernel.org/show_bug.cgi?id=206283
Signed-off-by: Vasily Averin <vvs@xxxxxxxxxxxxx>
---
kernel/trace/trace.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index ddb7e7f..a337764 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -5361,14 +5361,12 @@ static void *eval_map_next(struct seq_file *m, void *v, loff_t *pos)
* Paranoid! If ptr points to end, we don't want to increment past it.
* This really should never happen.
*/
+ (*pos)++;
ptr = update_eval_map(ptr);
if (WARN_ON_ONCE(!ptr))
return NULL;

ptr++;
-
- (*pos)++;
-
ptr = update_eval_map(ptr);

return ptr;
--
1.8.3.1