diff mbox series

cifs: Clarify an if-condition in SMB2_open_init()

Message ID 19c9ea1d0b1927d9550facbc5d1b43885bb3a327.1679071266.git.vl@samba.org (mailing list archive)
State New, archived
Headers show
Series cifs: Clarify an if-condition in SMB2_open_init() | expand

Commit Message

Volker Lendecke March 17, 2023, 4:42 p.m. UTC
(server->capabilities & SMB2_GLOBAL_CAP_LEASING) is the wrong
condition to stitch together the create contexts, what we really care
about is whether there already was a create context before the durable
one we just are about to add. This also aligns with the other cases
further down in SMB2_open_init().

Signed-off-by: Volker Lendecke <vl@samba.org>
---
 fs/cifs/smb2pdu.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index 0e53265e1462..5d06ecc9341b 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -2840,8 +2840,7 @@  SMB2_open_init(struct cifs_tcon *tcon, struct TCP_Server_Info *server,
 	}
 
 	if (*oplock == SMB2_OPLOCK_LEVEL_BATCH) {
-		/* need to set Next field of lease context if we request it */
-		if (server->capabilities & SMB2_GLOBAL_CAP_LEASING) {
+		if (n_iov > 2) {
 			struct create_context *ccontext =
 			    (struct create_context *)iov[n_iov-1].iov_base;
 			ccontext->Next =