stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Amir Goldstein <amir73il@gmail.com>,
	Miklos Szeredi <mszeredi@redhat.com>,
	Sasha Levin <sashal@kernel.org>,
	linux-unionfs@vger.kernel.org
Subject: [PATCH AUTOSEL 5.6 04/73] ovl: fix value of i_ino for lower hardlink corner case
Date: Sat, 18 Apr 2020 09:47:06 -0400	[thread overview]
Message-ID: <20200418134815.6519-4-sashal@kernel.org> (raw)
In-Reply-To: <20200418134815.6519-1-sashal@kernel.org>

From: Amir Goldstein <amir73il@gmail.com>

[ Upstream commit 300b124fcf6ad2cd99a7b721e0f096785e0a3134 ]

Commit 6dde1e42f497 ("ovl: make i_ino consistent with st_ino in more
cases"), relaxed the condition nfs_export=on in order to set the value of
i_ino to xino map of real ino.

Specifically, it also relaxed the pre-condition that index=on for
consistent i_ino. This opened the corner case of lower hardlink in
ovl_get_inode(), which calls ovl_fill_inode() with ino=0 and then
ovl_init_inode() is called to set i_ino to lower real ino without the xino
mapping.

Pass the correct values of ino;fsid in this case to ovl_fill_inode(), so it
can initialize i_ino correctly.

Fixes: 6dde1e42f497 ("ovl: make i_ino consistent with st_ino in more ...")
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 fs/overlayfs/inode.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/overlayfs/inode.c b/fs/overlayfs/inode.c
index 79e8994e3bc1a..3f993c114829e 100644
--- a/fs/overlayfs/inode.c
+++ b/fs/overlayfs/inode.c
@@ -891,7 +891,7 @@ struct inode *ovl_get_inode(struct super_block *sb,
 	struct dentry *lowerdentry = lowerpath ? lowerpath->dentry : NULL;
 	bool bylower = ovl_hash_bylower(sb, upperdentry, lowerdentry,
 					oip->index);
-	int fsid = bylower ? oip->lowerpath->layer->fsid : 0;
+	int fsid = bylower ? lowerpath->layer->fsid : 0;
 	bool is_dir, metacopy = false;
 	unsigned long ino = 0;
 	int err = oip->newinode ? -EEXIST : -ENOMEM;
@@ -941,6 +941,8 @@ struct inode *ovl_get_inode(struct super_block *sb,
 			err = -ENOMEM;
 			goto out_err;
 		}
+		ino = realinode->i_ino;
+		fsid = lowerpath->layer->fsid;
 	}
 	ovl_fill_inode(inode, realinode->i_mode, realinode->i_rdev, ino, fsid);
 	ovl_inode_init(inode, upperdentry, lowerdentry, oip->lowerdata);
-- 
2.20.1


  parent reply	other threads:[~2020-04-18 13:53 UTC|newest]

Thread overview: 73+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-18 13:47 [PATCH AUTOSEL 5.6 01/73] iommu/amd: Fix the configuration of GCR3 table root pointer Sasha Levin
2020-04-18 13:47 ` [PATCH AUTOSEL 5.6 02/73] tools/testing/nvdimm: Fix compilation failure without CONFIG_DEV_DAX_PMEM_COMPAT Sasha Levin
2020-04-18 13:47 ` [PATCH AUTOSEL 5.6 03/73] watchdog: reset last_hw_keepalive time at start Sasha Levin
2020-04-18 13:47 ` Sasha Levin [this message]
2020-04-18 13:47 ` [PATCH AUTOSEL 5.6 05/73] iommu/vt-d: Fix page request descriptor size Sasha Levin
2020-04-18 13:47 ` [PATCH AUTOSEL 5.6 06/73] acpi/nfit: improve bounds checking for 'func' Sasha Levin
2020-04-18 13:47 ` [PATCH AUTOSEL 5.6 07/73] iommu/vt-d: Fix mm reference leak Sasha Levin
2020-04-18 13:47 ` [PATCH AUTOSEL 5.6 08/73] scsi: lpfc: Fix kasan slab-out-of-bounds error in lpfc_unreg_login Sasha Levin
2020-04-18 13:47 ` [PATCH AUTOSEL 5.6 09/73] xfs: correctly acount for reclaimable slabs Sasha Levin
2020-04-18 13:47 ` [PATCH AUTOSEL 5.6 10/73] scsi: lpfc: Fix crash after handling a pci error Sasha Levin
2020-04-18 13:47 ` [PATCH AUTOSEL 5.6 11/73] scsi: lpfc: Fix crash in target side cable pulls hitting WAIT_FOR_UNREG Sasha Levin
2020-04-18 13:47 ` [PATCH AUTOSEL 5.6 12/73] scsi: libfc: If PRLI rejected, move rport to PLOGI state Sasha Levin
2020-04-18 13:47 ` [PATCH AUTOSEL 5.6 13/73] ceph: return ceph_mdsc_do_request() errors from __get_parent() Sasha Levin
2020-04-18 13:47 ` [PATCH AUTOSEL 5.6 14/73] ceph: don't skip updating wanted caps when cap is stale Sasha Levin
2020-04-18 13:47 ` [PATCH AUTOSEL 5.6 15/73] pwm: imx27: Fix clock handling in pwm_imx27_apply() Sasha Levin
2020-04-18 13:47 ` [PATCH AUTOSEL 5.6 16/73] pwm: rcar: Fix late Runtime PM enablement Sasha Levin
2020-04-18 13:47 ` [PATCH AUTOSEL 5.6 17/73] nvme-tcp: fix possible crash in write_zeroes processing Sasha Levin
2020-04-18 13:47 ` [PATCH AUTOSEL 5.6 18/73] ASoC: qcom: q6asm-dai: Add SNDRV_PCM_INFO_BATCH flag Sasha Levin
2020-04-18 13:47 ` [PATCH AUTOSEL 5.6 19/73] ASoC: dpcm: allow start or stop during pause for backend Sasha Levin
2020-04-18 13:47 ` [PATCH AUTOSEL 5.6 20/73] scsi: iscsi: Report unbind session event when the target has been removed Sasha Levin
2020-04-18 13:47 ` [PATCH AUTOSEL 5.6 21/73] tools/test/nvdimm: Fix out of tree build Sasha Levin
2020-04-18 13:47 ` [PATCH AUTOSEL 5.6 22/73] ASoC: Intel: atom: Take the drv->lock mutex before calling sst_send_slot_map() Sasha Levin
2020-04-18 13:47 ` [PATCH AUTOSEL 5.6 23/73] nvme: fix deadlock caused by ANA update wrong locking Sasha Levin
2020-04-18 13:47 ` [PATCH AUTOSEL 5.6 24/73] drm/amd/display: Update stream adjust in dc_stream_adjust_vmin_vmax Sasha Levin
2020-04-18 13:47 ` [PATCH AUTOSEL 5.6 25/73] dma-direct: fix data truncation in dma_direct_get_required_mask() Sasha Levin
2020-04-18 13:47 ` [PATCH AUTOSEL 5.6 26/73] dma-debug: fix displaying of dma allocation type Sasha Levin
2020-04-18 13:47 ` [PATCH AUTOSEL 5.6 27/73] kernel/gcov/fs.c: gcov_seq_next() should increase position index Sasha Levin
2020-04-18 13:47 ` [PATCH AUTOSEL 5.6 28/73] selftests: kmod: fix handling test numbers above 9 Sasha Levin
2020-04-18 13:47 ` [PATCH AUTOSEL 5.6 29/73] ipc/util.c: sysvipc_find_ipc() should increase position index Sasha Levin
2020-04-18 13:47 ` [PATCH AUTOSEL 5.6 30/73] kconfig: qconf: Fix a few alignment issues Sasha Levin
2020-04-18 13:47 ` [PATCH AUTOSEL 5.6 31/73] lib/raid6/test: fix build on distros whose /bin/sh is not bash Sasha Levin
2020-04-18 13:47 ` [PATCH AUTOSEL 5.6 32/73] block: fix busy device checking in blk_drop_partitions Sasha Levin
2020-04-18 13:47 ` [PATCH AUTOSEL 5.6 33/73] KVM: s390: vsie: Fix possible race when shadowing region 3 tables Sasha Levin
2020-04-18 13:47 ` [PATCH AUTOSEL 5.6 34/73] drm/nouveau: workaround runpm fail by disabling PCI power management on certain intel bridges Sasha Levin
2020-04-18 13:47 ` [PATCH AUTOSEL 5.6 35/73] s390/cio: generate delayed uevent for vfio-ccw subchannels Sasha Levin
2020-04-18 13:47 ` [PATCH AUTOSEL 5.6 36/73] s390/cio: avoid duplicated 'ADD' uevents Sasha Levin
2020-04-18 13:47 ` [PATCH AUTOSEL 5.6 37/73] loop: Better discard support for block devices Sasha Levin
2020-04-18 13:47 ` [PATCH AUTOSEL 5.6 38/73] pwm: pca9685: Fix PWM/GPIO inter-operation Sasha Levin
2020-04-18 13:47 ` [PATCH AUTOSEL 5.6 39/73] Revert "powerpc/64: irq_work avoid interrupt when called with hardware irqs enabled" Sasha Levin
2020-04-18 13:47 ` [PATCH AUTOSEL 5.6 40/73] powerpc/pseries: Fix MCE handling on pseries Sasha Levin
2020-04-18 13:47 ` [PATCH AUTOSEL 5.6 41/73] drm/amdkfd: kfree the wrong pointer Sasha Levin
2020-04-18 13:47 ` [PATCH AUTOSEL 5.6 42/73] nvme: fix compat address handling in several ioctls Sasha Levin
2020-04-18 13:47 ` [PATCH AUTOSEL 5.6 43/73] pwm: renesas-tpu: Fix late Runtime PM enablement Sasha Levin
2020-04-18 13:47 ` [PATCH AUTOSEL 5.6 44/73] pwm: bcm2835: Dynamically allocate base Sasha Levin
2020-04-18 13:47 ` [PATCH AUTOSEL 5.6 45/73] ceph: re-org copy_file_range and fix some error paths Sasha Levin
2020-04-18 13:47 ` [PATCH AUTOSEL 5.6 46/73] scsi: lpfc: Fix erroneous cpu limit of 128 on I/O statistics Sasha Levin
2020-04-18 13:47 ` [PATCH AUTOSEL 5.6 47/73] drm/vc4: Fix HDMI mode validation Sasha Levin
2020-04-18 13:47 ` [PATCH AUTOSEL 5.6 48/73] iommu/virtio: Fix freeing of incomplete domains Sasha Levin
2020-04-18 13:47 ` [PATCH AUTOSEL 5.6 49/73] iommu/vt-d: Add build dependency on IOASID Sasha Levin
2020-04-18 13:47 ` [PATCH AUTOSEL 5.6 50/73] scsi: lpfc: Fix lockdep error - register non-static key Sasha Levin
2020-04-18 13:47 ` [PATCH AUTOSEL 5.6 51/73] iommu/vt-d: Silence RCU-list debugging warning in dmar_find_atsr() Sasha Levin
2020-04-18 13:47 ` [PATCH AUTOSEL 5.6 52/73] platform/chrome: cros_ec_rpmsg: Fix race with host event Sasha Levin
2020-04-18 13:47 ` [PATCH AUTOSEL 5.6 53/73] libnvdimm: Out of bounds read in __nd_ioctl() Sasha Levin
2020-04-18 13:47 ` [PATCH AUTOSEL 5.6 54/73] platform/chrome: cros_ec: Query EC protocol version if EC transitions between RO/RW Sasha Levin
2020-04-18 13:47 ` [PATCH AUTOSEL 5.6 55/73] ocfs2: no need try to truncate file beyond i_size Sasha Levin
2020-04-18 13:47 ` [PATCH AUTOSEL 5.6 56/73] hfsplus: fix crash and filesystem corruption when deleting files Sasha Levin
2020-04-18 13:47 ` [PATCH AUTOSEL 5.6 57/73] ALSA: hda: Add driver blacklist Sasha Levin
2020-04-18 13:48 ` [PATCH AUTOSEL 5.6 58/73] ALSA: hda/realtek - Add quirk for MSI GL63 Sasha Levin
2020-04-18 13:48 ` [PATCH AUTOSEL 5.6 59/73] perf/core: Disable page faults when getting phys address Sasha Levin
2020-04-18 13:48 ` [PATCH AUTOSEL 5.6 60/73] libata: Return correct status in sata_pmp_eh_recover_pm() when ATA_DFLAG_DETACH is set Sasha Levin
2020-04-18 13:48 ` [PATCH AUTOSEL 5.6 61/73] drm/amd/display: Calculate scaling ratios on every medium/full update Sasha Levin
2020-04-18 13:48 ` [PATCH AUTOSEL 5.6 62/73] ALSA: ice1724: Fix invalid access for enumerated ctl items Sasha Levin
2020-04-18 13:48 ` [PATCH AUTOSEL 5.6 63/73] ALSA: hda: Fix potential access overflow in beep helper Sasha Levin
2020-04-18 13:48 ` [PATCH AUTOSEL 5.6 64/73] KVM: s390: vsie: Fix delivery of addressing exceptions Sasha Levin
2020-04-18 13:48 ` [PATCH AUTOSEL 5.6 65/73] ASoC: Intel: bytcr_rt5640: Add quirk for MPMAN MPWIN895CL tablet Sasha Levin
2020-04-18 13:48 ` [PATCH AUTOSEL 5.6 66/73] ipmi: fix hung processes in __get_guid() Sasha Levin
2020-04-18 13:48 ` [PATCH AUTOSEL 5.6 67/73] ALSA: usb-audio: Add Pioneer DJ DJM-250MK2 quirk Sasha Levin
2020-04-18 13:48 ` [PATCH AUTOSEL 5.6 68/73] ALSA: hda/realtek - Add quirk for Lenovo Carbon X1 8th gen Sasha Levin
2020-04-18 13:48 ` [PATCH AUTOSEL 5.6 69/73] scsi: mpt3sas: Fix kernel panic observed on soft HBA unplug Sasha Levin
2020-04-18 13:48 ` [PATCH AUTOSEL 5.6 70/73] xhci: Ensure link state is U3 after setting USB_SS_PORT_LS_U3 Sasha Levin
2020-04-18 13:48 ` [PATCH AUTOSEL 5.6 71/73] xhci: Wait until link state trainsits to U0 after setting USB_SS_PORT_LS_U0 Sasha Levin
2020-04-18 13:48 ` [PATCH AUTOSEL 5.6 72/73] xhci: Finetune host initiated USB3 rootport link suspend and resume Sasha Levin
2020-04-18 13:48 ` [PATCH AUTOSEL 5.6 73/73] block: fix busy device checking in blk_drop_partitions again 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=20200418134815.6519-4-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=amir73il@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-unionfs@vger.kernel.org \
    --cc=mszeredi@redhat.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).