Re: [PATCH v2 2/2] smb: client: don't use read data that failed signature verification

From: Paulo Alcantara

Date: Wed Nov 18 2026 - 17:03:48 EST


Suyuan Wang via B4 Relay <devnull+shyckless.gmail.com@xxxxxxxxxx>
writes:

> From: Suyuan Wang <stevewong@xxxxxxxxxxx>
>
> 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.
>
> Clear got_bytes when the signature check fails, as the retry path in the
> same function already does.

Please check sashiko's review.