Skip to content

Commit b50492b

Browse files
Paulo Alcantarasmfrench
authored andcommitted
smb: client: fix potential OOB in cifs_dump_detail()
Validate SMB message with ->check_message() before calling ->calc_smb_size(). Signed-off-by: Paulo Alcantara (SUSE) <[email protected]> Cc: [email protected] Signed-off-by: Steve French <[email protected]>
1 parent b35858b commit b50492b

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

fs/smb/client/cifs_debug.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,13 @@ void cifs_dump_detail(void *buf, struct TCP_Server_Info *server)
4040
#ifdef CONFIG_CIFS_DEBUG2
4141
struct smb_hdr *smb = buf;
4242

43-
cifs_dbg(VFS, "Cmd: %d Err: 0x%x Flags: 0x%x Flgs2: 0x%x Mid: %d Pid: %d\n",
44-
smb->Command, smb->Status.CifsError,
45-
smb->Flags, smb->Flags2, smb->Mid, smb->Pid);
46-
cifs_dbg(VFS, "smb buf %p len %u\n", smb,
47-
server->ops->calc_smb_size(smb));
43+
cifs_dbg(VFS, "Cmd: %d Err: 0x%x Flags: 0x%x Flgs2: 0x%x Mid: %d Pid: %d Wct: %d\n",
44+
smb->Command, smb->Status.CifsError, smb->Flags,
45+
smb->Flags2, smb->Mid, smb->Pid, smb->WordCount);
46+
if (!server->ops->check_message(buf, server->total_read, server)) {
47+
cifs_dbg(VFS, "smb buf %p len %u\n", smb,
48+
server->ops->calc_smb_size(smb));
49+
}
4850
#endif /* CONFIG_CIFS_DEBUG2 */
4951
}
5052

0 commit comments

Comments
 (0)