Linux CIFS filesystem development
 help / color / mirror / Atom feed
* [PATCH 1/4] smb: client: fix parsing of SMB3.1.1 POSIX create context
@ 2024-01-19  4:08 Paulo Alcantara
  2024-01-19  4:08 ` [PATCH 2/4] smb: client: parse owner/group when creating reparse points Paulo Alcantara
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Paulo Alcantara @ 2024-01-19  4:08 UTC (permalink / raw)
  To: smfrench; +Cc: linux-cifs, Paulo Alcantara

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>
---
 fs/smb/client/smb2pdu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/smb/client/smb2pdu.c b/fs/smb/client/smb2pdu.c
index 44abd4deb9eb..288199f0b987 100644
--- a/fs/smb/client/smb2pdu.c
+++ b/fs/smb/client/smb2pdu.c
@@ -2308,7 +2308,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.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-01-19  4:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-19  4:08 [PATCH 1/4] smb: client: fix parsing of SMB3.1.1 POSIX create context Paulo Alcantara
2024-01-19  4:08 ` [PATCH 2/4] smb: client: parse owner/group when creating reparse points Paulo Alcantara
2024-01-19  4:08 ` [PATCH 3/4] smb: client: get rid of smb311_posix_query_path_info() Paulo Alcantara
2024-01-19  4:08 ` [PATCH 4/4] smb: client: don't clobber ->i_rdev from cached reparse points Paulo Alcantara
2024-01-19  4:45 ` [PATCH 1/4] smb: client: fix parsing of SMB3.1.1 POSIX create context Steve French

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox