From: Paulo Alcantara <pc@manguebit.org>
To: shyckless@gmail.com, linkinjeon@kernel.org
Cc: bharathsm@microsoft.com, samba-technical@lists.samba.org,
dhowells@redhat.com, smfrench@gmail.com, ematsumiya@suse.de,
sprasad@microsoft.com, linux-kernel@vger.kernel.org,
linux-cifs@vger.kernel.org, tom@talpey.com,
ronniesahlberg@gmail.com
Subject: Re: [PATCH v3] smb: client: don't use read data that failed signature verification
Date: Thu, 19 Nov 2026 15:47:03 -0300 [thread overview]
Message-ID: <152a019923a02a65186a1c305810c299@manguebit.org> (raw)
In-Reply-To: <20261119-smb2-readv-v3-1-f3a8a2eddb1c@gmail.com>
Suyuan Wang via B4 Relay <devnull+shyckless.gmail.com@kernel.org>
writes:
> From: Suyuan Wang <stevewong@hust.edu.cn>
>
> 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".
> ...
Applied with the redudant 'rdata->result = 0' removed.
prev parent reply other threads:[~2026-11-19 18:47 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-19 4:00 Suyuan Wang via B4 Relay
2026-11-19 18:47 ` Paulo Alcantara [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=152a019923a02a65186a1c305810c299@manguebit.org \
--to=pc@manguebit.org \
--cc=bharathsm@microsoft.com \
--cc=dhowells@redhat.com \
--cc=ematsumiya@suse.de \
--cc=linkinjeon@kernel.org \
--cc=linux-cifs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ronniesahlberg@gmail.com \
--cc=samba-technical@lists.samba.org \
--cc=shyckless@gmail.com \
--cc=smfrench@gmail.com \
--cc=sprasad@microsoft.com \
--cc=tom@talpey.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®