From patchwork Tue Mar 5 06:14:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve French X-Patchwork-Id: 1051632 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-cifs-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="GvZ4oaCN"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 44D67F3GX8z9s4Y for ; Tue, 5 Mar 2019 17:14:49 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726301AbfCEGOr (ORCPT ); Tue, 5 Mar 2019 01:14:47 -0500 Received: from mail-pg1-f176.google.com ([209.85.215.176]:46200 "EHLO mail-pg1-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726026AbfCEGOr (ORCPT ); Tue, 5 Mar 2019 01:14:47 -0500 Received: by mail-pg1-f176.google.com with SMTP id 196so4880302pgf.13 for ; Mon, 04 Mar 2019 22:14:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to:cc; bh=IPVZabYIsEdw0yGIPjDuXb27q54PK5zqb5weCbYA5CU=; b=GvZ4oaCNICS1nGpO75V4Zg98+ioEkffwkLE+7VfQTLyUPFGztNcZnEQKmtsd7zzmfs ri1ghQKZgq2rXgW8hcd/XxH+Duhitd/1SxzYtwccbKwAzgtZkHaDz2jQgC/izchx0ahW GddGCRSIq0qV9mJUUtWmyxqgchEfD/MDdNVTUksoWdj24zciDOX5frwO+pt5LTUs1jL6 H/ETMllGUH58farqHqQHvfZj5CjB6URrxdTiPVrYpIvOTwovDwEnZXwLFpiG37dDYzQj UlSvyLFgk7c4QpcKmQljlX282bVHnvGBlbUZC1wsBkzK8MwNb18SKKZOveVi0QIZd09b zJHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=IPVZabYIsEdw0yGIPjDuXb27q54PK5zqb5weCbYA5CU=; b=rN88XqORAm+UEVZwGzy+cApkjc6b+5RQgOZeSKKpbcbbCNi/ZkaDPHH2GzF8yJ2lB8 AYPK7H4hFXLTGjYvpetUt2s9aT3l4YwtD4o9zlhPnpNGfZLcBvQ4de8KVTnnMURVYuQl csADsZB0edaQYUubVx74Q/h4eIj7Y1hnPYDS+j8fgguWGzf1lmwN/03Q4o1Z7dTnNAkY NZpqb4O1UlvhyScNTyGU4djA3+bPfbKixkC0xWmhEqANahfzxM0zilJXORaTsJGSnSmh cZKNf1zTMaXWDJ5awsvgDuDVUkKW3tFPvAEIIaPDPZfnexHY10h1L6IrBDvLQs/OUsWA KErQ== X-Gm-Message-State: APjAAAV1SIbS5uHMooywrMv3TD8jzTKHHodO2zO10AMGCL9Qx7C2yYLh mKj2Qxo6/4aEVqhzi+80N0/IKSt3cn2Twnrj95kIbg== X-Google-Smtp-Source: APXvYqzTFY27/wxa7JMieD+9o1Ve3NaqLz0JKCC0AemFfv+K+FkXmsRNf3ojzzUc9w8pBLEKJspnaOrZMhlDNXn0+4M= X-Received: by 2002:a63:1053:: with SMTP id 19mr22391296pgq.55.1551766486617; Mon, 04 Mar 2019 22:14:46 -0800 (PST) MIME-Version: 1.0 From: Steve French Date: Tue, 5 Mar 2019 00:14:34 -0600 Message-ID: Subject: [PATCH] CIFS: fix FSCTL_SET_REPARSE_POINT SMB2_ioctl() call To: CIFS Cc: =?utf-8?q?Aur=C3=A9lien_Aptel?= Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org merged Aurelien's small patch (attached) into cifs-2.6.git for-next Reviewed-by: Ronnie Sahlberg From 778d81b65e4d596251943002522d94a7c6fbcf69 Mon Sep 17 00:00:00 2001 From: Aurelien Aptel Date: Mon, 4 Mar 2019 18:50:18 +0100 Subject: [PATCH] CIFS: fix FSCTL_SET_REPARSE_POINT SMB2_ioctl() call Without this change the ioctl() fails with INVALID_PARAMETER. Since SET_REPARSE_POINT has no output, set the max output response size to zero. [MS-SMB2] reads 3.3.5.15 Receiving an SMB2 IOCTL Request If either InputCount, MaxInputResponse, or MaxOutputResponse is greater than Connection.MaxTransactSize, the server SHOULD<306> fail the request with STATUS_INVALID_PARAMETER. The server MUST fail the request with STATUS_INVALID_PARAMETER in the following cases: * If InputOffset is greater than zero but less than (size of SMB2 header + size of the SMB2 IOCTL request not including Buffer) or if InputOffset is greater than (size of SMB2 header + size of the SMB2 IOCTL request). * If OutputOffset is greater than zero but less than (size of SMB2 header + size of the SMB2 IOCTL request not including Buffer) or if OutputOffset is greater than (size of SMB2 header + size of the SMB2 IOCTL request). * If (InputOffset + InputCount) is greater than (size of SMB2 header + size of the SMB2 IOCTL request). * If (OutputOffset + OutputCount) is greater than (size of SMB2 header + size of the SMB2 IOCTL request). * If OutputCount is greater than zero and OutputOffset is less than (InputOffset + InputCount). Signed-off-by: Aurelien Aptel Signed-off-by: Steve French --- fs/cifs/smb2pdu.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c index 733021566356..cacdf9bf9ef3 100644 --- a/fs/cifs/smb2pdu.c +++ b/fs/cifs/smb2pdu.c @@ -2539,7 +2539,10 @@ SMB2_ioctl(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid, * in responses (except for read responses which can be bigger. * We may want to bump this limit up */ - req->MaxOutputResponse = cpu_to_le32(CIFSMaxBufSize); + if (opcode == FSCTL_SET_REPARSE_POINT) + req->MaxOutputResponse = cpu_to_le32(0); + else + req->MaxOutputResponse = cpu_to_le32(CIFSMaxBufSize); if (is_fsctl) req->Flags = cpu_to_le32(SMB2_0_IOCTL_IS_FSCTL); -- 2.17.1