]> git.itanic.dy.fi Git - linux-stable/commit
tcm_fileio: Prevent information leak for short reads
authorDmitry Monakhov <dmonakhov@openvz.org>
Fri, 31 Mar 2017 15:53:35 +0000 (19:53 +0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 24 Mar 2018 10:00:20 +0000 (11:00 +0100)
commitf29bc9dc0bef0cb6f3ca069d96fbd535439d1680
tree4547ad14ec8d7559923db0a18f3f87f25143d3d8
parent9935f862199bf7ddc2d26fad089b756fab0ad816
tcm_fileio: Prevent information leak for short reads

[ Upstream commit f11b55d13563e9428c88c873f4f03a6bef11ec0a ]

If we failed to read data from backing file (probably because some one
truncate file under us), we must zerofill cmd's data, otherwise it will
be returned as is. Most likely cmd's data are unitialized pages from
page cache. This result in information leak.

(Change BUG_ON into -EINVAL se_cmd failure - nab)

testcase: https://github.com/dmonakhov/xfstests/commit/e11a1b7b907ca67b1be51a1594025600767366d5
Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/target/target_core_file.c