]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
bpf: map_seq_next should always increase position index
authorVasily Averin <vvs@virtuozzo.com>
Sat, 25 Jan 2020 09:10:02 +0000 (12:10 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 24 Feb 2020 07:36:58 +0000 (08:36 +0100)
commit3ce3df5d00d08e0a12acceb8ff7d23fd4c8d1cee
treeb1ad381fc237a078c07ff1031cd623be8b27a21f
parent9a178494d05b4a8c338ce07a0f9ca6f42bc58c58
bpf: map_seq_next should always increase position index

[ Upstream commit 90435a7891a2259b0f74c5a1bc5600d0d64cba8f ]

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

See also: https://bugzilla.kernel.org/show_bug.cgi?id=206283

v1 -> v2: removed missed increment in end of function

Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/eca84fdd-c374-a154-d874-6c7b55fc3bc4@virtuozzo.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
kernel/bpf/inode.c