From patchwork Sun Nov 4 04:35:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve French X-Patchwork-Id: 992704 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="Ca0NSO7I"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 42njg52Q9LzB4jy for ; Sun, 4 Nov 2018 15:36:01 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729037AbeKDNtc (ORCPT ); Sun, 4 Nov 2018 08:49:32 -0500 Received: from mail-pl1-f196.google.com ([209.85.214.196]:46930 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729024AbeKDNtc (ORCPT ); Sun, 4 Nov 2018 08:49:32 -0500 Received: by mail-pl1-f196.google.com with SMTP id c13-v6so2817311plz.13 for ; Sat, 03 Nov 2018 21:35:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=FcGO2dWEd066IBTJOfH/Zv/MdX3ny0gn+Hhin19we+k=; b=Ca0NSO7I2yUpLgRxeQJmPiwe04amgUQaqCFlyc1F9VzptjALlkHkwW40J4YbumBfuv nIkzhqfXcDRsebxMksdukGaYMZkfKrfisuzQRtOIgD3qr0vKIsK0vgiyHGqoBXhevdCF aZWwOgWs7KZfFng4+S3EE9n1PTbg76ows/n/mfLa6hfZxvtpN47ob1zjCGMFqTH2ZwBj jSAgPbSpmCC5FuwFmK+Zrt/6xpKTfSLYgLk3HHmQbvrNu88oTF+7SfH6KXhQsYxShnVj IR/lUSfPuGDxgtRvtblHLoKT03zXjO6/eRGbmXCz9Mm9JGD1D2ChoLQukoeTUIyAKmZw aJ2g== 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; bh=FcGO2dWEd066IBTJOfH/Zv/MdX3ny0gn+Hhin19we+k=; b=aaZ7jog4j0zgejnrpUgsaLoOK5cd7P6Odvi9+aP71eTuow+USmo0YF7TA4L8FLnyZv a5cw+w6hm322w9deY9OeH34BPV3jO7xhhtgtk2Cfbtx+8H9A9/rpyoTcgP6flGiZTTZq DV3I0D0gNmwXCXYr22RZW+2f0Uld3f+j/H4OxyqnyN05ibJpkykCuYy9xjt2zeOLzk/e Hs1AU8FaWMT+eA9Exvg79eqhjxPzg9KncS6UuoL37OWcARa4DxtAZkPG0Thcq/1MNSfy i6qIGMfRbreug7K8AclwG7jWeps/MXmgzALd6m+FKzEEmKkB8e85sJ/tms0s4u6DXItv MJpw== X-Gm-Message-State: AGRZ1gJemna1A/g4vxB5+YUsr3wYwEw38e6jT8FuCn8OfR/CwkrzAX3R yYuvLGk70gbDaIxv3XQMXuns70Y30IOsBLX7uB+JMvLb X-Google-Smtp-Source: AJdET5c/BRTz95dmBOa7n6DPpXL6/JUSM7qxzhMeK6uDvymY3HUbjiD3n0vvI1OD8K8Me16i/NTlYCsJds9nnAe2yGA= X-Received: by 2002:a17:902:5c4:: with SMTP id f62-v6mr17644716plf.18.1541306158507; Sat, 03 Nov 2018 21:35:58 -0700 (PDT) MIME-Version: 1.0 From: Steve French Date: Sat, 3 Nov 2018 23:35:47 -0500 Message-ID: Subject: [PATCH] smb3: do not call cifs functions in error path in rename To: CIFS Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org If the server returned EBUSY during rename we could fall back to SMB1 in an error path when using SMB2/SMB3. Make sure we check the dialect before calling CIFS_open there. Signed-off-by: Steve French --- fs/cifs/inode.c | 4 ++++ 1 file changed, 4 insertions(+) /* open the file to be renamed -- we need DELETE perms */ From 007bb3005d40164d0067e618cf25f49de3c016a1 Mon Sep 17 00:00:00 2001 From: Steve French Date: Sat, 3 Nov 2018 23:24:26 -0500 Subject: [PATCH] smb3: do not call cifs functions in error path in rename If the server returned EBUSY during rename we could fall back to SMB1 in an error path when using SMB2/SMB3. Make sure we check the dialect before calling CIFS_open there. Signed-off-by: Steve French --- fs/cifs/inode.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index a81a9df997c1..72b6e44a2162 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c @@ -1743,6 +1743,10 @@ cifs_do_rename(const unsigned int xid, struct dentry *from_dentry, if (to_dentry->d_parent != from_dentry->d_parent) goto do_rename_exit; + /* If not CIFS (vers=1.0) do not call CIFS/SMB1 functions below */ + if (strcmp(server->vals->version_string, SMB1_VERSION_STRING) != 0) + goto do_rename_exit; + oparms.tcon = tcon; oparms.cifs_sb = cifs_sb; /* open the file to be renamed -- we need DELETE perms */ -- 2.17.1