]> git.hungrycats.org Git - linux/commit
smb: client: handle max length for SMB symlinks
authorPaulo Alcantara <pc@manguebit.com>
Mon, 18 Nov 2024 15:35:16 +0000 (12:35 -0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 5 Dec 2024 12:54:24 +0000 (13:54 +0100)
commit2ae227f8c2793036bcf0c2ff9f34f2b34a74722c
treebd040b688c93c6defaacc368664b021b1db082d5
parent5fa30c58dd22d08eb1694a6eed3f7ae6e60767f0
smb: client: handle max length for SMB symlinks

commit 0812340811e45ec4039d409049be53056182a552 upstream.

We can't use PATH_MAX for SMB symlinks because

  (1) Windows Server will fail FSCTL_SET_REPARSE_POINT with
      STATUS_IO_REPARSE_DATA_INVALID when input buffer is larger than
      16K, as specified in MS-FSA 2.1.5.10.37.

  (2) The client won't be able to parse large SMB responses that
      includes SMB symlink path within SMB2_CREATE or SMB2_IOCTL
      responses.

Fix this by defining a maximum length value (4060) for SMB symlinks
that both client and server can handle.

Cc: David Howells <dhowells@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: Paulo Alcantara (Red Hat) <pc@manguebit.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/smb/client/reparse.c
fs/smb/client/reparse.h