tcm_fileio: Prevent information leak for short reads
authorDmitry Monakhov <dmonakhov@openvz.org>
Fri, 31 Mar 2017 15:53:35 +0000 (19:53 +0400)
committerNicholas Bellinger <nab@linux-iscsi.org>
Tue, 2 May 2017 05:20:57 +0000 (22:20 -0700)
commitf11b55d13563e9428c88c873f4f03a6bef11ec0a
tree52b323f26cd056b8e6bb6d0c8a2d173ea172d8ee
parent0e2eb7d12eaa8e391bf5615d4271bb87a649caaa
tcm_fileio: Prevent information leak for short reads

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>
drivers/target/target_core_file.c