]> git.baikalelectronics.ru Git - kernel.git/commit
kernel/relay.c: fix read_pos error when multiple readers
authorPengcheng Yang <yangpc@wangsu.com>
Thu, 4 Jun 2020 23:51:30 +0000 (16:51 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 May 2023 09:35:58 +0000 (11:35 +0200)
commit247ee6cb959fa27f32945ffffa2a5d6bb5590f70
tree6bd460f4033e9a8fa82612e3ac3b0c0da517d4f9
parent0da21253d1a50913eb396de22dc1dc6d77e27286
kernel/relay.c: fix read_pos error when multiple readers

[ Upstream commit 786538fa5e06c22ae95da248a39ce02702792848 ]

When reading, read_pos should start with bytes_consumed, not file->f_pos.
Because when there is more than one reader, the read_pos corresponding to
file->f_pos may have been consumed, which will cause the data that has
been consumed to be read and the bytes_consumed update error.

Signed-off-by: Pengcheng Yang <yangpc@wangsu.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Jens Axboe <axboe@kernel.dk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Jann Horn <jannh@google.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>e
Link: http://lkml.kernel.org/r/1579691175-28949-1-git-send-email-yangpc@wangsu.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Stable-dep-of: 43ec16f1450f ("relayfs: fix out-of-bounds access in relay_file_read")
Signed-off-by: Sasha Levin <sashal@kernel.org>
kernel/relay.c