Message ID | eca84fdd-c374-a154-d874-6c7b55fc3bc4@virtuozzo.com |
---|---|
State | Accepted |
Delegated to: | BPF Maintainers |
Headers | show |
Series | [v2] map_seq_next should increase position index | expand |
On 1/25/20 10:10 AM, Vasily Averin wrote: > v2: removed missed increment in end of function > > 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@virtuozzo.com> Applied, thanks!
diff --git a/kernel/bpf/inode.c b/kernel/bpf/inode.c index ecf42be..6f22e0e 100644 --- a/kernel/bpf/inode.c +++ b/kernel/bpf/inode.c @@ -196,6 +196,7 @@ static void *map_seq_next(struct seq_file *m, void *v, loff_t *pos) void *key = map_iter(m)->key; void *prev_key; + (*pos)++; if (map_iter(m)->done) return NULL; @@ -208,8 +209,6 @@ static void *map_seq_next(struct seq_file *m, void *v, loff_t *pos) map_iter(m)->done = true; return NULL; } - - ++(*pos); return key; }
v2: removed missed increment in end of function 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@virtuozzo.com> --- kernel/bpf/inode.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)