Skip to content

Commit 11d4d1d

Browse files
Paulo AlcantaraSteve French
authored andcommitted
smb: client: increase number of PDUs allowed in a compound request
With the introduction of SMB2_OP_QUERY_WSL_EA, the client may now send 5 commands in a single compound request in order to query xattrs from potential WSL reparse points, which should be fine as we currently allow up to 5 PDUs in a single compound request. However, if encryption is enabled (e.g. 'seal' mount option) or enforced by the server, current MAX_COMPOUND(5) won't be enough as we require an extra PDU for the transform header. Fix this by increasing MAX_COMPOUND to 7 and, while we're at it, add an WARN_ON_ONCE() and return -EIO instead of -ENOMEM in case we attempt to send a compound request that couldn't include the extra transform header. Signed-off-by: Paulo Alcantara <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent 6aac002 commit 11d4d1d

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

fs/smb/client/cifsglob.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
#define SMB_INTERFACE_POLL_INTERVAL 600
8888

8989
/* maximum number of PDUs in one compound */
90-
#define MAX_COMPOUND 5
90+
#define MAX_COMPOUND 7
9191

9292
/*
9393
* Default number of credits to keep available for SMB3.

fs/smb/client/transport.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -435,8 +435,8 @@ smb_send_rqst(struct TCP_Server_Info *server, int num_rqst,
435435
if (!(flags & CIFS_TRANSFORM_REQ))
436436
return __smb_send_rqst(server, num_rqst, rqst);
437437

438-
if (num_rqst > MAX_COMPOUND - 1)
439-
return -ENOMEM;
438+
if (WARN_ON_ONCE(num_rqst > MAX_COMPOUND - 1))
439+
return -EIO;
440440

441441
if (!server->ops->init_transform_rq) {
442442
cifs_server_dbg(VFS, "Encryption requested but transform callback is missing\n");

0 commit comments

Comments
 (0)