All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: David Howells <dhowells@redhat.com>,
	Sasha Levin <sashal@kernel.org>,
	linux-afs@lists.infradead.org
Subject: [PATCH AUTOSEL 4.19 06/27] afs: Only update d_fsdata if different in afs_d_revalidate()
Date: Tue, 20 Aug 2019 09:41:52 -0400	[thread overview]
Message-ID: <20190820134213.11279-6-sashal@kernel.org> (raw)
In-Reply-To: <20190820134213.11279-1-sashal@kernel.org>

From: David Howells <dhowells@redhat.com>

[ Upstream commit 5dc84855b0fc7e1db182b55c5564fd539d6eff92 ]

In the in-kernel afs filesystem, d_fsdata is set with the data version of
the parent directory.  afs_d_revalidate() will update this to the current
directory version, but it shouldn't do this if it the value it read from
d_fsdata is the same as no lock is held and cmpxchg() is not used.

Fix the code to only change the value if it is different from the current
directory version.

Fixes: 260a980317da ("[AFS]: Add "directory write" support.")
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 fs/afs/dir.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/afs/dir.c b/fs/afs/dir.c
index 855bf2b79fed4..54e7f6f1405e2 100644
--- a/fs/afs/dir.c
+++ b/fs/afs/dir.c
@@ -937,7 +937,7 @@ static int afs_d_revalidate(struct dentry *dentry, unsigned int flags)
 	dir_version = (long)dir->status.data_version;
 	de_version = (long)dentry->d_fsdata;
 	if (de_version == dir_version)
-		goto out_valid;
+		goto out_valid_noupdate;
 
 	dir_version = (long)dir->invalid_before;
 	if (de_version - dir_version >= 0)
@@ -1001,6 +1001,7 @@ static int afs_d_revalidate(struct dentry *dentry, unsigned int flags)
 
 out_valid:
 	dentry->d_fsdata = (void *)dir_version;
+out_valid_noupdate:
 	dput(parent);
 	key_put(key);
 	_leave(" = 1 [valid]");
-- 
2.20.1


  parent reply	other threads:[~2019-08-20 13:46 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-20 13:41 [PATCH AUTOSEL 4.19 01/27] dmaengine: ste_dma40: fix unneeded variable warning Sasha Levin
2019-08-20 13:41 ` [PATCH AUTOSEL 4.19 02/27] nvme-multipath: revalidate nvme_ns_head gendisk in nvme_validate_ns Sasha Levin
2019-08-20 13:41 ` [PATCH AUTOSEL 4.19 03/27] afs: Fix the CB.ProbeUuid service handler to reply correctly Sasha Levin
2019-08-20 13:41 ` [PATCH AUTOSEL 4.19 04/27] afs: Fix loop index mixup in afs_deliver_vl_get_entry_by_name_u() Sasha Levin
2019-08-20 13:41 ` [PATCH AUTOSEL 4.19 05/27] fs: afs: Fix a possible null-pointer dereference in afs_put_read() Sasha Levin
2019-08-20 13:41 ` Sasha Levin [this message]
2019-08-20 13:41 ` [PATCH AUTOSEL 4.19 07/27] intel_th: Use the correct style for SPDX License Identifier Sasha Levin
2019-08-20 13:47   ` Joe Perches
2019-08-20 19:37     ` Sasha Levin
2019-08-20 13:41 ` [PATCH AUTOSEL 4.19 08/27] nvmet-loop: Flush nvme_delete_wq when removing the port Sasha Levin
2019-08-20 13:41 ` [PATCH AUTOSEL 4.19 09/27] nvme: fix a possible deadlock when passthru commands sent to a multipath device Sasha Levin
2019-08-20 13:41 ` [PATCH AUTOSEL 4.19 10/27] nvme-pci: Fix async probe remove race Sasha Levin
2019-08-20 13:41 ` [PATCH AUTOSEL 4.19 11/27] soundwire: cadence_master: fix register definition for SLAVE_STATE Sasha Levin
2019-08-20 13:41 ` [PATCH AUTOSEL 4.19 12/27] soundwire: cadence_master: fix definitions for INTSTAT0/1 Sasha Levin
2019-08-20 13:41 ` [PATCH AUTOSEL 4.19 13/27] iio: adc: max9611: Fix temperature reading in probe Sasha Levin
2019-08-20 13:42 ` [PATCH AUTOSEL 4.19 14/27] auxdisplay: panel: need to delete scan_timer when misc_register fails in panel_attach Sasha Levin
2019-08-20 13:42 ` [PATCH AUTOSEL 4.19 15/27] dmaengine: stm32-mdma: Fix a possible null-pointer dereference in stm32_mdma_irq_handler() Sasha Levin
2019-08-20 13:42 ` [PATCH AUTOSEL 4.19 16/27] omap-dma/omap_vout_vrfb: fix off-by-one fi value Sasha Levin
2019-08-20 13:42 ` [PATCH AUTOSEL 4.19 17/27] iommu/dma: Handle SG length overflow better Sasha Levin
2019-08-20 13:42   ` Sasha Levin
2019-08-20 13:42 ` [PATCH AUTOSEL 4.19 18/27] usb: gadget: composite: Clear "suspended" on reset/disconnect Sasha Levin
2019-08-20 13:42 ` [PATCH AUTOSEL 4.19 19/27] usb: gadget: mass_storage: Fix races between fsg_disable and fsg_set_alt Sasha Levin
2019-08-20 13:42 ` [PATCH AUTOSEL 4.19 20/27] xen/blkback: fix memory leaks Sasha Levin
2019-08-20 13:42 ` [PATCH AUTOSEL 4.19 21/27] arm64: cpufeature: Don't treat granule sizes as strict Sasha Levin
2019-08-20 13:42 ` [PATCH AUTOSEL 4.19 22/27] i2c: rcar: avoid race when unregistering slave client Sasha Levin
2019-08-20 13:42 ` [PATCH AUTOSEL 4.19 23/27] i2c: emev2: " Sasha Levin
2019-08-20 13:42 ` [PATCH AUTOSEL 4.19 24/27] drm/ast: Fixed reboot test may cause system hanged Sasha Levin
2019-08-20 13:42   ` Sasha Levin
2019-08-20 13:42 ` [PATCH AUTOSEL 4.19 25/27] usb: host: fotg2: restart hcd after port reset Sasha Levin
2019-08-20 13:42 ` [PATCH AUTOSEL 4.19 26/27] tools: hv: fixed Python pep8/flake8 warnings for lsvmbus Sasha Levin
2019-08-20 13:42 ` [PATCH AUTOSEL 4.19 27/27] tools: hv: fix KVP and VSS daemons exit code Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190820134213.11279-6-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=dhowells@redhat.com \
    --cc=linux-afs@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.