All of lore.kernel.org
 help / color / mirror / Atom feed
From: Guruswamy Basavaiah <guruswamy.basavaiah@broadcom.com>
To: stable@vger.kernel.org, gregkh@linuxfoundation.org
Cc: ajay.kaher@broadcom.com, tapas.kundu@broadcom.com,
	Guruswamy Basavaiah <guruswamy.basavaiah@broadcom.com>,
	Paulo Alcantara <pc@manguebit.com>,
	Steve French <stfrench@microsoft.com>
Subject: [PATCH 5.10.y 3/3] smb: client: fix parsing of SMB3.1.1 POSIX create context
Date: Sun, 11 Feb 2024 01:42:36 +0530	[thread overview]
Message-ID: <20240210201237.3089385-3-guruswamy.basavaiah@broadcom.com> (raw)
In-Reply-To: <20240210201237.3089385-1-guruswamy.basavaiah@broadcom.com>

From: Paulo Alcantara <pc@manguebit.com>

[ Upstream commit 76025cc2285d9ede3d717fe4305d66f8be2d9346 ]

The data offset for the SMB3.1.1 POSIX create context will always be
8-byte aligned so having the check 'noff + nlen >= doff' in
smb2_parse_contexts() is wrong as it will lead to -EINVAL because noff
+ nlen == doff.

Fix the sanity check to correctly handle aligned create context data.

Fixes: af1689a9b770 ("smb: client: fix potential OOBs in smb2_parse_contexts()")
Signed-off-by: Paulo Alcantara <pc@manguebit.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
[Guru:smb2_parse_contexts()  is present in file smb2ops.c,
smb2ops.c file location is changed, modified patch accordingly.]
Signed-off-by: Guruswamy Basavaiah <guruswamy.basavaiah@broadcom.com>
---
 fs/cifs/smb2pdu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index 541f7d6aaf3d..a358c139ba74 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -2095,7 +2095,7 @@ int smb2_parse_contexts(struct TCP_Server_Info *server,
 
 		noff = le16_to_cpu(cc->NameOffset);
 		nlen = le16_to_cpu(cc->NameLength);
-		if (noff + nlen >= doff)
+		if (noff + nlen > doff)
 			return -EINVAL;
 
 		name = (char *)cc + noff;
-- 
2.25.1


  parent reply	other threads:[~2024-02-10 20:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-10 20:12 [PATCH 5.15.y 1/3] smb: client: fix OOB in receive_encrypted_standard() Guruswamy Basavaiah
2024-02-10 20:12 ` [PATCH 5.10.y 2/3] smb: client: fix potential OOBs in smb2_parse_contexts() Guruswamy Basavaiah
2024-02-10 20:12 ` Guruswamy Basavaiah [this message]
2024-02-10 20:12 ` [PATCH 5.15.y 0/3] Backport Fixes to 5.15.y Guruswamy Basavaiah
2024-02-10 20:55   ` Guruswamy Basavaiah
2024-02-11 20:46     ` Guruswamy Basavaiah
  -- strict thread matches above, loose matches on Subject: below --
2024-02-10 20:14 [PATCH 5.10.y 1/3] smb: client: fix OOB in receive_encrypted_standard() Guruswamy Basavaiah
2024-02-10 20:14 ` [PATCH 5.10.y 3/3] smb: client: fix parsing of SMB3.1.1 POSIX create context Guruswamy Basavaiah

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240210201237.3089385-3-guruswamy.basavaiah@broadcom.com \
    --to=guruswamy.basavaiah@broadcom.com \
    --cc=ajay.kaher@broadcom.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=pc@manguebit.com \
    --cc=stable@vger.kernel.org \
    --cc=stfrench@microsoft.com \
    --cc=tapas.kundu@broadcom.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.