summaryrefslogtreecommitdiffstats
path: root/fs/cifs
diff options
context:
space:
mode:
authorPavel Shilovsky <pshilov@microsoft.com>2016-11-18 00:24:34 +0100
committerSteve French <smfrench@gmail.com>2017-02-01 23:46:36 +0100
commit9bb17e0916a03ab901fb684e874d77a1e96b3d1e (patch)
tree5a4dc378ba0665c7c8f4684ad195c1294cba755f /fs/cifs
parentCIFS: Encrypt SMB3 requests before sending (diff)
downloadlinux-9bb17e0916a03ab901fb684e874d77a1e96b3d1e.tar.xz
linux-9bb17e0916a03ab901fb684e874d77a1e96b3d1e.zip
CIFS: Add transform header handling callbacks
We need to recognize and parse transformed packets in demultiplex thread to find a corresponsing mid and process it further. Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
Diffstat (limited to 'fs/cifs')
-rw-r--r--fs/cifs/cifsglob.h3
-rw-r--r--fs/cifs/connect.c17
2 files changed, 15 insertions, 5 deletions
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
index 14196e00f79e..35cf62ba5416 100644
--- a/fs/cifs/cifsglob.h
+++ b/fs/cifs/cifsglob.h
@@ -440,6 +440,9 @@ struct smb_version_operations {
struct smb_rqst *);
/* free transform request */
void (*free_transform_rq)(struct smb_rqst *);
+ int (*is_transform_hdr)(void *buf);
+ int (*receive_transform)(struct TCP_Server_Info *,
+ struct mid_q_entry **);
};
struct smb_version_values {
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index b84febf960e9..35faa6cb7f82 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -872,12 +872,19 @@ cifs_demultiplex_thread(void *p)
continue;
server->total_read += length;
- mid_entry = server->ops->find_mid(server, buf);
+ if (server->ops->is_transform_hdr &&
+ server->ops->receive_transform &&
+ server->ops->is_transform_hdr(buf)) {
+ length = server->ops->receive_transform(server,
+ &mid_entry);
+ } else {
+ mid_entry = server->ops->find_mid(server, buf);
- if (!mid_entry || !mid_entry->receive)
- length = standard_receive3(server, mid_entry);
- else
- length = mid_entry->receive(server, mid_entry);
+ if (!mid_entry || !mid_entry->receive)
+ length = standard_receive3(server, mid_entry);
+ else
+ length = mid_entry->receive(server, mid_entry);
+ }
if (length < 0)
continue;