]> git.baikalelectronics.ru Git - kernel.git/commit
smb3: enumerating snapshots was leaving part of the data off end
authorSteve French <stfrench@microsoft.com>
Thu, 9 Aug 2018 19:33:12 +0000 (14:33 -0500)
committerSteve French <stfrench@microsoft.com>
Fri, 10 Aug 2018 02:20:01 +0000 (21:20 -0500)
commitcec767ef8989e6be8895d4d3c76a16307577ed03
tree01cf76e9fd5a7a732257db28b522fb9d7aae8702
parent835b1048d8e51eed3f953175c0b89e053f3b2467
smb3: enumerating snapshots was leaving part of the data off end

When enumerating snapshots, the last few bytes of the final
snapshot could be left off since we were miscalculating the
length returned (leaving off the sizeof struct SRV_SNAPSHOT_ARRAY)
See MS-SMB2 section 2.2.32.2. In addition fixup the length used
to allow smaller buffer to be passed in, in order to allow
returning the size of the whole snapshot array more easily.

Sample userspace output with a kernel patched with this
(mounted to a Windows volume with two snapshots).
Before this patch, the second snapshot would be missing a
few bytes at the end.

~/cifs-2.6# ~/enum-snapshots /mnt/file
press enter to issue the ioctl to retrieve snapshot information ...

size of snapshot array = 102
Num snapshots: 2 Num returned: 2 Array Size: 102

Snapshot 0:@GMT-2018.06.30-19.34.17
Snapshot 1:@GMT-2018.06.30-19.33.37

CC: Stable <stable@vger.kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
Reviewed-by: Pavel Shilovsky <pshilov@microsoft.com>
fs/cifs/smb2ops.c