diff options
author | Pavel Shilovsky <piastry@etersoft.ru> | 2012-01-12 13:40:50 -0500 |
---|---|---|
committer | Pavel Shilovsky <pshilovsky@samba.org> | 2012-07-24 13:54:54 -0400 |
commit | 3792c1732878822ebf5a1c7e83e23453b9bbb698 (patch) | |
tree | e8c901db3f440f21233d24f9ebd65be29624b5e5 /fs/cifs/cifsfs.c | |
parent | 093b2bdad3221e3fae3c26d89387e7297a157664 (diff) |
CIFS: Respect SMB2 header/max header size
Use SMB2 header size values for allocation and memset because they
are bigger and suitable for both CIFS and SMB2.
Signed-off-by: Pavel Shilovsky <piastry@etersoft.ru>
Signed-off-by: Steve French <smfrench@gmail.com>
Diffstat (limited to 'fs/cifs/cifsfs.c')
-rw-r--r-- | fs/cifs/cifsfs.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index 2e9929dc2072..7a7cda9f7912 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c | |||
@@ -48,6 +48,9 @@ | |||
48 | #include <linux/key-type.h> | 48 | #include <linux/key-type.h> |
49 | #include "cifs_spnego.h" | 49 | #include "cifs_spnego.h" |
50 | #include "fscache.h" | 50 | #include "fscache.h" |
51 | #ifdef CONFIG_CIFS_SMB2 | ||
52 | #include "smb2pdu.h" | ||
53 | #endif | ||
51 | #define CIFS_MAGIC_NUMBER 0xFF534D42 /* the first four bytes of SMB PDUs */ | 54 | #define CIFS_MAGIC_NUMBER 0xFF534D42 /* the first four bytes of SMB PDUs */ |
52 | 55 | ||
53 | int cifsFYI = 0; | 56 | int cifsFYI = 0; |
@@ -980,6 +983,14 @@ cifs_destroy_inodecache(void) | |||
980 | static int | 983 | static int |
981 | cifs_init_request_bufs(void) | 984 | cifs_init_request_bufs(void) |
982 | { | 985 | { |
986 | size_t max_hdr_size = MAX_CIFS_HDR_SIZE; | ||
987 | #ifdef CONFIG_CIFS_SMB2 | ||
988 | /* | ||
989 | * SMB2 maximum header size is bigger than CIFS one - no problems to | ||
990 | * allocate some more bytes for CIFS. | ||
991 | */ | ||
992 | max_hdr_size = MAX_SMB2_HDR_SIZE; | ||
993 | #endif | ||
983 | if (CIFSMaxBufSize < 8192) { | 994 | if (CIFSMaxBufSize < 8192) { |
984 | /* Buffer size can not be smaller than 2 * PATH_MAX since maximum | 995 | /* Buffer size can not be smaller than 2 * PATH_MAX since maximum |
985 | Unicode path name has to fit in any SMB/CIFS path based frames */ | 996 | Unicode path name has to fit in any SMB/CIFS path based frames */ |
@@ -991,8 +1002,7 @@ cifs_init_request_bufs(void) | |||
991 | } | 1002 | } |
992 | /* cERROR(1, "CIFSMaxBufSize %d 0x%x",CIFSMaxBufSize,CIFSMaxBufSize); */ | 1003 | /* cERROR(1, "CIFSMaxBufSize %d 0x%x",CIFSMaxBufSize,CIFSMaxBufSize); */ |
993 | cifs_req_cachep = kmem_cache_create("cifs_request", | 1004 | cifs_req_cachep = kmem_cache_create("cifs_request", |
994 | CIFSMaxBufSize + | 1005 | CIFSMaxBufSize + max_hdr_size, 0, |
995 | MAX_CIFS_HDR_SIZE, 0, | ||
996 | SLAB_HWCACHE_ALIGN, NULL); | 1006 | SLAB_HWCACHE_ALIGN, NULL); |
997 | if (cifs_req_cachep == NULL) | 1007 | if (cifs_req_cachep == NULL) |
998 | return -ENOMEM; | 1008 | return -ENOMEM; |