aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>2017-05-12 11:59:32 -0400
committerSteve French <smfrench@gmail.com>2017-05-12 20:55:56 -0400
commitcd1230070ae1c12fd34cf6a557bfa81bf9311009 (patch)
treebf041ef190ca864408e994002c30eafeb8f86176
parentecdcf622eb74b52cebde1387a7a1852a787d8050 (diff)
SMB2: Fix share type handling
In fs/cifs/smb2pdu.h, we have: #define SMB2_SHARE_TYPE_DISK 0x01 #define SMB2_SHARE_TYPE_PIPE 0x02 #define SMB2_SHARE_TYPE_PRINT 0x03 Knowing that, with the current code, the SMB2_SHARE_TYPE_PRINT case can never trigger and printer share would be interpreted as disk share. So, test the ShareType value for equality instead. Fixes: faaf946a7d5b ("CIFS: Add tree connect/disconnect capability for SMB2") Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Acked-by: Aurelien Aptel <aaptel@suse.com> Signed-off-by: Steve French <smfrench@gmail.com>
-rw-r--r--fs/cifs/smb2pdu.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index e0517f499c38..e4afdaae743f 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -1240,15 +1240,19 @@ SMB2_tcon(const unsigned int xid, struct cifs_ses *ses, const char *tree,
1240 goto tcon_exit; 1240 goto tcon_exit;
1241 } 1241 }
1242 1242
1243 if (rsp->ShareType & SMB2_SHARE_TYPE_DISK) 1243 switch (rsp->ShareType) {
1244 case SMB2_SHARE_TYPE_DISK:
1244 cifs_dbg(FYI, "connection to disk share\n"); 1245 cifs_dbg(FYI, "connection to disk share\n");
1245 else if (rsp->ShareType & SMB2_SHARE_TYPE_PIPE) { 1246 break;
1247 case SMB2_SHARE_TYPE_PIPE:
1246 tcon->ipc = true; 1248 tcon->ipc = true;
1247 cifs_dbg(FYI, "connection to pipe share\n"); 1249 cifs_dbg(FYI, "connection to pipe share\n");
1248 } else if (rsp->ShareType & SMB2_SHARE_TYPE_PRINT) { 1250 break;
1249 tcon->print = true; 1251 case SMB2_SHARE_TYPE_PRINT:
1252 tcon->ipc = true;
1250 cifs_dbg(FYI, "connection to printer\n"); 1253 cifs_dbg(FYI, "connection to printer\n");
1251 } else { 1254 break;
1255 default:
1252 cifs_dbg(VFS, "unknown share type %d\n", rsp->ShareType); 1256 cifs_dbg(VFS, "unknown share type %d\n", rsp->ShareType);
1253 rc = -EOPNOTSUPP; 1257 rc = -EOPNOTSUPP;
1254 goto tcon_error_exit; 1258 goto tcon_error_exit;