From patchwork Tue Dec 6 22:02:33 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Shilovskiy X-Patchwork-Id: 9463327 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E607F60231 for ; Tue, 6 Dec 2016 22:17:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D7EB8284F0 for ; Tue, 6 Dec 2016 22:17:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CCF93284F4; Tue, 6 Dec 2016 22:17:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 764C3284F0 for ; Tue, 6 Dec 2016 22:17:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752135AbcLFWR6 (ORCPT ); Tue, 6 Dec 2016 17:17:58 -0500 Received: from mail-bn3nam01on0107.outbound.protection.outlook.com ([104.47.33.107]:27253 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751618AbcLFWR5 (ORCPT ); Tue, 6 Dec 2016 17:17:57 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=XwbBHWMF2ArgVBsW6P5DkFU6DTQw/IUKTDiy1gbzu6I=; b=Xshs9E0FvMZ8/SByB7/YZnHveaPy5TRCceM2YJdKHq8NY/7JE9HzghijRAB/YVpBfrftcr0YAOlN1/XlmuKunmGY0MJkR9Ug67yvSFInVZJk5Pw0tpoBpknsKVa87q1YMC/h6Cw+BQoT7ZFFsUDTNHEq1chQermQJW19Js+ToHs= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=pshilov@microsoft.com; Received: from ubuntu-vm.corp.microsoft.com (2001:4898:80e8:2::63b) by CY4PR03MB2549.namprd03.prod.outlook.com (10.173.41.148) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.761.9; Tue, 6 Dec 2016 22:02:49 +0000 From: Pavel Shilovsky To: linux-cifs@vger.kernel.org Subject: [PATCH 10/15] CIFS: Add transform header handling callbacks Date: Tue, 6 Dec 2016 14:02:33 -0800 Message-Id: <1481061758-52020-11-git-send-email-pshilov@microsoft.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1481061758-52020-1-git-send-email-pshilov@microsoft.com> References: <1481061758-52020-1-git-send-email-pshilov@microsoft.com> MIME-Version: 1.0 X-Originating-IP: [2001:4898:80e8:2::63b] X-ClientProxiedBy: CY1PR17CA0004.namprd17.prod.outlook.com (10.163.68.14) To CY4PR03MB2549.namprd03.prod.outlook.com (10.173.41.148) X-MS-Office365-Filtering-Correlation-Id: 1b07b792-2d08-445f-fb12-08d41e239e31 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:CY4PR03MB2549; X-Microsoft-Exchange-Diagnostics: 1; CY4PR03MB2549; 3:kXQGgkoB48LUlNPzHTPtWQt8kKUSsVA06f35A1epcWf1DU5X+zvJXdiQgDGG/mTvmqDW00tDIhjBAHeEAnU7iU//NWrwrUSFOJiK+NSoKYIrGMd0CD1rXqAQeOs7PjvEEKccx7XjXcAXryPS3CjSBUBA3192My6v5qmml5Ji9a9alj7oJEq46cmeOLs6J1Erz+xkV4z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5pymeP/ugbscGLifva5umZavtMbhrnNDIPxFfr5HX5MghG2Hb+RayeRWjJAAptECkMwlQVjNTxjrkEJUppcmnMNRiYhKtanOLgriot4CzLHcoZzAYH+8ZuEUIK6gcRiLy7z7jt6hzi3jwPT1bWgU74e62059HnPJvD1xoiW5E5i5QuZq+4gCqn0rIEOKMEnehH+cOAfHV8Ff8EATDLZMhxZit5OYmG0meUBeQrpYAt3SyWQWL1wmBF2HNeJSaOwMAT9QH7I2DRnkq1OP/3ynrSEoWvzIEiVP4OwHgy88ky4QjIzh4LGr2FvJzYq X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6055026)(6041248)(20161123560025)(20161123562025)(20161123564025)(20161123555025)(6047074)(6072148); SRVR:CY4PR03MB2549; BCL:0; PCL:0; RULEID:; SRVR:CY4PR03MB2549; X-Microsoft-Exchange-Diagnostics: 1; CY4PR03MB2549; 4:OLDnk+YuEVHt6+0nr5LmDsL0YS4uYc1MxkKtZWzx2wk90hPEKXzGfjM6KvvfDjCbam9F3SXGwU7HcsY7hhssivPenSDaQVjAt1NAC997lYWs77GQlJygvcWzgWJcXtEb694JOzrkLDlDARBWoCqqqN1cQRYAAHIxBjqwej6wHCFhU3U74aGAuttFmEzjJNi3hFlWwieS1Rqw4ixam9ho9ZDYFbzXG+N1lWsWZTVo0++pCOm+KRG9VchIyfolH3PKzr0yk9MNIJkk2w+I/2aqwrGj7LmbEB+gPNSAKHBAQ+WQGmpOh9gnfOWMkdEaK4LnuR+CLX/BwiWn34QjI6AIWFj7rrgunljwknZTvU08hHbpyZ6+i063qFjPsqYv7L3UQ4OLW7281tAlvlzoATp5DGSAFEJhkFY4fLyy3nsaTYbIPS3yk9EUFJ15rQShG4cTDIH7BWKV/aZgo8u7c6OiZ1YUGcDrjl4dePnZoXwEFwnbtFxZgqFdf1RpJpBZsCFxt26oJrAgN7RDaJNqpzRuQlDJY/RcH8TFTbLzHq6+OZtOooT6A4kcpLhnMoBXW4EbNX//aCfWu3pjv4u0YwTKC+9lXHwLI2Xw8dr6nRqD9A0= X-Forefront-PRVS: 01480965DA X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(7916002)(199003)(189002)(50466002)(92566002)(101416001)(86362001)(33646002)(47776003)(48376002)(2950100002)(6916009)(106356001)(105586002)(6666003)(50986999)(42186005)(39860400001)(39850400001)(39840400001)(86612001)(76176999)(2361001)(110136003)(2351001)(450100001)(189998001)(5660300001)(10090500001)(5003940100001)(10290500002)(38730400001)(5005710100001)(8676002)(6116002)(36756003)(107886002)(39410400001)(733004)(7846002)(2906002)(39450400002)(6486002)(7736002)(50226002)(68736007)(305945005)(81156014)(97736004)(81166006); DIR:OUT; SFP:1102; SCL:1; SRVR:CY4PR03MB2549; H:ubuntu-vm.corp.microsoft.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY4PR03MB2549; 23:4LV7HTFXTKTlKBb1DIvwmwG11jueMFTbaBGpkgfcr?= =?us-ascii?Q?OQerC2/f4uJoMe60GmGy04Xo/VcyaH9StN29VLVqaWNQD8SxSgH12SIOqc0V?= =?us-ascii?Q?sI64d4C+pBs/wMwnz4SNlH4NWY76F3ooB/mk8Vb5swJ1yfsMbNK3ux1eiJEt?= =?us-ascii?Q?+ksbvjDC1I6nkkxT8DpVFe5KKaD7JBkxvBfkwKoZaF9yt+vEKkS7cU144VZy?= =?us-ascii?Q?BXdfODuJQczmvRR6uxg3J11qx1R0r2BClzBXtqWryyDTpT3cRpL7kdSJdypQ?= =?us-ascii?Q?f4B+4fOoup7fIJMqs8rHiqtFlZjo+3pHuDkUbA0nLrFz1AXbnaYEwPpX/TzZ?= =?us-ascii?Q?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MKMat4g6PAMZVIP83xd28XS0Bpr?= =?us-ascii?Q?cN6jBmSpElIsN9pl5+3BiQaBXgkwilmNVmFma6Ypx5/KfZ3PSTVtQY5p2eNs?= =?us-ascii?B?dz09?= X-Microsoft-Exchange-Diagnostics: 1; CY4PR03MB2549; 6:Fq78w0UC++MHAw9gRTS3Al3y/I24hQ6/IDuveEJARi6PGkOarVp6eg+W9vnsuVtfqGgOtsMnCM8xRn0F1+23i06e0rEr7wc21rRAQeqmprwYgW0Ty26vO4K9QYXrLohVx+kIDiGwjsFNFybh1dCoNHnN6x6P/epukSRV5KceUZ707FED3gTMsUjMODYmAB3hvBbWb9ZIxlP0mS/kjigoxo9muT2cBXprdvXcj8Ka0RpzYVKSr44dxBvZ5PmL4lbk2yskf7cmBm5BmwgCxxSulOCHCHK5ito0ZWjq6ICxqydR/rmuBEDzJFMIJpj2keqzjspMvGW9bCogBB0sZubnjH60IO1b5Teybdp63/zXRreg6ozYuy1u53laKT+7Xblel8aAV2xS2g9Q6d3ai7CX0UuRMT5V/93TVuTSPYSG5rLspDLkJRXDmIaGsjrNGF4RLYd2f1Bh7k/I7EhsoXQonA==; 5:QqY34G7nOnUmAgHe0n/YeMU0+bvdYkE2KASEUWMKlFE4RwFtH60B6R1tGwRPOvl0m9fSZ58Yf4LoVRbBh+GJg5q36Njh4F5G/PPFzJCjRV2k6v64bW71hSyhMXjJ9DJuHl/793xXhRRrpkMYlsAnlRnaDNmI1KpWF0iRLgdIk1w=; 24:175DbPACRwqBOdo4su1ku34xpLvG7rnkJtX2DUHpLw4WgNqodhcdcSyscnlB8l0tc4Fm82ln7StoOvJFIX/UPYKpsgOQySPeLbPuk7iyxXA= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY4PR03MB2549; 7:sPjZOY0cv8pGSzjK6aKzChuzfdxNAXxwd8ZAhHxFBaDvWtp2r8MXWSOnIR/7elIjzZqDzYKJVvo3w3jbLIbnT2H2LgEEn7M74lEOntbQAGK3PyBpieY2L1L/4PkNJacH9tlhzhYFcdVcF4BV9IQEfLUIHzJNCkkYbD0CwOUsJkHKbDHhFhJdzX0SaezEcZrNftO2zer1CYDqhpw6iCNCi3dHK41rUIfam8aYwABAGbyM1vWwZ9fy2fq/tKG5w8Ensz2lz+Chz5Tt5Qf/oPmyS7nd66FnJjaOp6NFTU0itmBUH6GTsErnftaBY6vC//7haunZjnFK615qaAVj/b3vdcA7SPyo4/mvnAKuNHHjq4NIZ44PBIvfEVt2eqjYYsAUvG/kQc5SnFggfojRRsPu5qZxYmdjXPqdJzCbGjW9QEITTPlwp3OkAlUXr9ze5BilFIKa9fvxGw5loe5KpAirRw== X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Dec 2016 22:02:49.1956 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR03MB2549 Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- fs/cifs/cifsglob.h | 3 +++ fs/cifs/connect.c | 17 ++++++++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index 9433a9b..1d1cdea 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 46124a0..3a2183a 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -869,12 +869,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;