CIFS: fix max ea value size
authorMurphy Zhou <jencce.kernel@gmail.com>
Sat, 21 Sep 2019 11:26:00 +0000 (19:26 +0800)
committerSteve French <stfrench@microsoft.com>
Tue, 24 Sep 2019 04:28:59 +0000 (23:28 -0500)
It should not be larger then the slab max buf size. If user
specifies a larger size, it passes this check and goes
straightly to SMB2_set_info_init performing an insecure memcpy.

Signed-off-by: Murphy Zhou <jencce.kernel@gmail.com>
Reviewed-by: Aurelien Aptel <aaptel@suse.com>
CC: Stable <stable@vger.kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/cifs/xattr.c

index 9076150758d88e20efae50771db8ad1f820a478e..db4ba8f6077e1c7977ce282d7320407868ace671 100644 (file)
@@ -31,7 +31,7 @@
 #include "cifs_fs_sb.h"
 #include "cifs_unicode.h"
 
-#define MAX_EA_VALUE_SIZE 65535
+#define MAX_EA_VALUE_SIZE CIFSMaxBufSize
 #define CIFS_XATTR_CIFS_ACL "system.cifs_acl"
 #define CIFS_XATTR_ATTRIB "cifs.dosattrib"  /* full name: user.cifs.dosattrib */
 #define CIFS_XATTR_CREATETIME "cifs.creationtime"  /* user.cifs.creationtime */