summaryrefslogtreecommitdiff
path: root/kernel/debug
diff options
context:
space:
mode:
authorSuyuan Wang <stevewong@hust.edu.cn>2026-11-19 04:00:48 +0000
committerPaulo Alcantara <pc@manguebit.org>2026-11-19 12:02:54 -0300
commita1a0ef3ba8e802060bfc2b0ebf131a2cf98c3b71 (patch)
tree3a36382e930823715cb5b537e5194682b3ea2a6d /kernel/debug
parentf834c81f108f8bdb0e3aa8375a536fb6dda56c70 (diff)
smb: client: don't use read data that failed signature verification
When smb2_readv_callback() finds a bad signature, it sets the error in rdata->result but leaves rdata->got_bytes alone. Further down, a short read that reaches the remote EOF clears the error again: size_t trans = rdata->subreq.transferred + rdata->got_bytes; if (trans < rdata->subreq.len && rdata->subreq.start + trans >= netfs_read_remote_i_size(inode)) { rdata->result = 0; and got_bytes is then added to subreq.transferred. So the last part of a file, or all of a small one, is returned even though its signature is wrong. Clearing got_bytes is not enough on its own. If the read starts at or past the cached remote size, for example because the file has grown on the server since the size was last fetched, the check above still matches and the error turns into EOF, or into a zero-filled tail when NETFS_SREQ_CLEAR_TAIL is set. Clear got_bytes when the signature check fails, as the retry path in the same function already does, and only treat a short read as hitting the remote EOF when the read itself succeeded. That is what commit 1da29f2c39b6 ("netfs, cifs: Fix handling of short DIO read") describes: "clear the error if a short read occurred without error and the read-to file position is now at the remote inode size". Found with a static analysis tool and checked by hand. Fixes: 1da29f2c39b6 ("netfs, cifs: Fix handling of short DIO read") Cc: stable@vger.kernel.org Co-developed-by: Kaixuan Li <kaixuan.li@ntu.edu.sg> Signed-off-by: Kaixuan Li <kaixuan.li@ntu.edu.sg> Signed-off-by: Suyuan Wang <stevewong@hust.edu.cn> Signed-off-by: Paulo Alcantara <pc@manguebit.org>
Diffstat (limited to 'kernel/debug')
0 files changed, 0 insertions, 0 deletions