Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp9444ybl; Tue, 7 Jan 2020 13:04:52 -0800 (PST) X-Google-Smtp-Source: APXvYqzfwErbYOcdM0u/tCC9ObkYW5AhFawV54AT7WTBl99fk/x19EVoRgTksxVv9ItUPL1nrfp2 X-Received: by 2002:a9d:6f8f:: with SMTP id h15mr1582970otq.1.1578431092328; Tue, 07 Jan 2020 13:04:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578431092; cv=none; d=google.com; s=arc-20160816; b=qinjy3agByBIW9konHW7qPxXS0RbQc/gkFWhNAApsJOk3DZq/Uno8jWH6HWrhKqxKp HvKsYyMbZIUsq/8X8p5sdXRZE9SfHMWPSWEA0jMJfRV4z1gYy3PnhjIfQv++t+5hfyXX gt9KIz9M1ZfhQyYp7aRhlwAfROngVYx5Bc8XsTznExsKQGQYF/lFJOWKQto2nJ9nxsTi 9uECKMKYs1IeHqxvssydAEExVz5NsY54uXLjxdtkP4HFbDr9+NnnFDj2CWrAy6VCib5Y A8a/FfUvZ4bmvapi6cJFaxm8p56z+PjhMqVYx8NXOi9vJtwbt4HHt6mXsl1i9jB99V+G 9htg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=otSk9MxTBFJiZwl/M22RsnRFOEsIqRT9w2M8vHGSy2s=; b=rFDOrCDIeu07FD1fAtL9cIUUIB18Ua2q0FaPwvD2dG/ZVyaUrfQaC9RPLGbpzHRBnF P6MB7YIl0G0MdVh8rDwMbOjwsCMHDgaVHZIyMXYBi7t9tXfxL9BYLB14PhxOjKYdZMQn 1jQAvFvevR/uLIORuWgX5qF9VMF4fwHTOxul4vVm9hT11Jn7ZzfQTQsU7kDnWFscKZq4 YeKqoMcUNw7v8YdEBiTHxVnWGkzVVfTYDuZpPjo5Xz+FNiSXus+Gc5D0oP1AIkhoKR7e bCOCSHDwrvzldR4rZuFv3US4ZKA9cTHS+kKwWxIr1dEnoLzZrkpRqFI33r/OTgh1fCWv aEGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=RiIr8yTy; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t125si615236oih.183.2020.01.07.13.04.39; Tue, 07 Jan 2020 13:04:52 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=RiIr8yTy; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729000AbgAGVEB (ORCPT + 99 others); Tue, 7 Jan 2020 16:04:01 -0500 Received: from mail.kernel.org ([198.145.29.99]:46958 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728043AbgAGVDy (ORCPT ); Tue, 7 Jan 2020 16:03:54 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E7B7E2081E; Tue, 7 Jan 2020 21:03:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431034; bh=qQqkLG6E4zlxNyW71ejH7Xg6ZNSF3zn+NcXKNezev8k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RiIr8yTyknmDAemZk5w80NFsfxsIcumO2e5cFw5mi8kurtfVb2Byb1TllYNA4dmdu FZF634h8InI+9byBlAZ8pWtIpWHgUgbnytCUaLTmJt++swdxufgR1cJcOFts4yfppA HMprsuvWtqvAXEfw8Lryus4dHzD4M6a8L+XllpWo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Deepa Dinamani , stfrench@microsoft.com, linux-cifs@vger.kernel.org Subject: [PATCH 5.4 171/191] fs: cifs: Fix atime update check vs mtime Date: Tue, 7 Jan 2020 21:54:51 +0100 Message-Id: <20200107205342.153253181@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200107205332.984228665@linuxfoundation.org> References: <20200107205332.984228665@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Deepa Dinamani commit 69738cfdfa7032f45d9e7462d24490e61cf163dd upstream. According to the comment in the code and commit log, some apps expect atime >= mtime; but the introduced code results in atime==mtime. Fix the comparison to guard against atime Cc: stfrench@microsoft.com Cc: linux-cifs@vger.kernel.org Signed-off-by: Steve French Signed-off-by: Greg Kroah-Hartman --- fs/cifs/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c @@ -163,7 +163,7 @@ cifs_fattr_to_inode(struct inode *inode, spin_lock(&inode->i_lock); /* we do not want atime to be less than mtime, it broke some apps */ - if (timespec64_compare(&fattr->cf_atime, &fattr->cf_mtime)) + if (timespec64_compare(&fattr->cf_atime, &fattr->cf_mtime) < 0) inode->i_atime = fattr->cf_mtime; else inode->i_atime = fattr->cf_atime;