public inbox for linux-unionfs@vger.kernel.org
 help / color / mirror / Atom feed
* [4.13-rc1 regression] copyup crashes kernel when initializing selinux
@ 2017-07-17  9:37 Eryu Guan
  2017-07-17 11:25 ` Miklos Szeredi
  0 siblings, 1 reply; 4+ messages in thread
From: Eryu Guan @ 2017-07-17  9:37 UTC (permalink / raw)
  To: linux-unionfs; +Cc: Miklos Szeredi

Hi all,

I hit a kernel crash with 4.13-rc1 kernel when running fstests
overlay/005. And git bisect pointed first bad to this commit

commit 09d8b586731bf589655c2ac971532c14cf272b63
Author: Miklos Szeredi <mszeredi@redhat.com>
Date:   Tue Jul 4 22:03:16 2017 +0200

    ovl: move __upperdentry to ovl_inode

    Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>

inode_doinit_with_dentry wants to read the upper inode's xattr to get
selinux information, and ovl_xattr_get() calls ovl_dentry_real(), which
depends on dentry->d_inode, but d_inode is null and not initialized yet
at this moment.

Mount overlay without selinux context mount option and trigger copyup
could reproduce the crash reliably. (The crash log I appended is from a
bisect run, so the kernel version is not exact 4.13-rc1.)

Thanks,
Eryu

[15136.565669] BUG: unable to handle kernel NULL pointer dereference at 0000000000000240
[15136.605036] IP: ovl_dentry_real+0xd/0x30 [overlay]
[15136.629005] PGD 103a5ee067
[15136.629006] P4D 103a5ee067
[15136.643113] PUD 105e89d067
[15136.657419] PMD 0
[15136.670541]
[15136.687288] Oops: 0000 [#1] SMP
[15136.702068] Modules linked in: ext4 jbd2 mbcache overlay xt_CHECKSUM ipt_MASQUERADE nf_nat_masquerade_ipv4 tun ip6t_rpfilter ipt_REJECT nf_reject_ipv4 ip6t_REJECT nf_reject_ipv6 xt_conntrack ip_set nfnetlink ebtable_nat ebtable_broute bridge stp llc ip6table_nat nf_conntrack_ipv6 nf_defrag_ipv6 nf_nat_ipv6 ip6table_mangle ip6table_security ip6table_raw iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4 nf_nat nf_conntrack iptable_mangle iptable_security iptable_raw ebtable_filter ebtables ip6table_filter ip6_tables iptable_filter btrfs intel_rapl x86_pkg_temp_thermal intel_powerclamp coretemp xor kvm_intel kvm raid6_pq irqbypass crct10dif_pclmul crc32_pclmul ghash_clmulni_intel pcbc iTCO_wdt ipmi_ssif aesni_intel iTCO_vendor_support crypto_simd glue_helper cryptd ipmi_si pcspkr nf
 sd hpwdt i2c_i801
[15137.033172]  hpilo lpc_ich ipmi_devintf sg ioatdma pcc_cpufreq ipmi_msghandler shpchp wmi dca acpi_power_meter auth_rpcgss nfs_acl lockd grace sunrpc ip_tables xfs libcrc32c sd_mod mgag200 i2c_algo_bit drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops ttm drm tg3 uas ptp serio_raw usb_storage hpsa crc32c_intel i2c_core pps_core scsi_transport_sas dm_mirror dm_region_hash dm_log dm_mod
[15137.200427] CPU: 4 PID: 7866 Comm: xfs_io Not tainted 4.12.0-rc7.debug+ #88
[15137.231617] Hardware name: HP ProLiant DL360 Gen9, BIOS P89 05/06/2015
[15137.260917] task: ffff88105b1c4b00 task.stack: ffffc90023658000
[15137.287439] RIP: 0010:ovl_dentry_real+0xd/0x30 [overlay]
[15137.311190] RSP: 0018:ffffc9002365bac0 EFLAGS: 00010282
[15137.334735] RAX: 0000000000000000 RBX: ffff8810289240c0 RCX: 00000000000000ff
[15137.366725] RDX: ffff88085c387b00 RSI: ffffffff81a5ef37 RDI: ffff8810289240c0
[15137.398486] RBP: ffffc9002365bac0 R08: ffff88085c387b00 R09: 00000000000000ff
[15137.430450] R10: ffffffffa07cf110 R11: ffffea00415c2a00 R12: ffff8810289240c0
[15137.462878] R13: ffffffff81a5ef37 R14: ffff88085c387b00 R15: 00000000000000ff
[15137.494813] FS:  00007f6ff6d81740(0000) GS:ffff88107fc00000(0000) knlGS:0000000000000000
[15137.531514] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[15137.558574] CR2: 0000000000000240 CR3: 0000001025790000 CR4: 00000000001406e0
[15137.592356] Call Trace:
[15137.603955]  ovl_xattr_get+0x23/0x60 [overlay]
[15137.624905]  ovl_other_xattr_get+0x1a/0x20 [overlay]
[15137.649068]  __vfs_getxattr+0x57/0x70
[15137.666286]  inode_doinit_with_dentry+0x33c/0x580
[15137.690801]  selinux_d_instantiate+0x1c/0x20
[15137.712277]  security_d_instantiate+0x32/0x50
[15137.734914]  d_add+0x22/0x150
[15137.749899]  ovl_lookup+0x297/0x810 [overlay]
[15137.771522]  path_openat+0xd7f/0x1350
[15137.790593]  do_filp_open+0x91/0x100
[15137.808597]  ? __alloc_fd+0x46/0x170
[15137.825813]  do_sys_open+0x124/0x210
[15137.842935]  SyS_open+0x1e/0x20
[15137.857010]  do_syscall_64+0x67/0x150
[15137.873476]  entry_SYSCALL64_slow_path+0x25/0x25
[15137.893868] RIP: 0033:0x7f6ff6963e90
[15137.909841] RSP: 002b:00007fff21f3cba8 EFLAGS: 00000246 ORIG_RAX: 0000000000000002
[15137.943843] RAX: ffffffffffffffda RBX: 0000000000000002 RCX: 00007f6ff6963e90
[15137.976972] RDX: 0000000000000180 RSI: 0000000000000002 RDI: 00007fff21f3f5ad
[15138.009875] RBP: 0000000000000000 R08: 00007fff21f3cd20 R09: 0000000000000000
[15138.041726] R10: 00007fff21f3c8c0 R11: 0000000000000246 R12: 0000000000000005
[15138.073742] R13: 00007fff21f3cd20 R14: 00007fff21f3f5ad R15: 00007fff21f3cd60
[15138.106904] Code: 44 00 00 55 48 8b 47 78 48 89 e5 8b 50 20 85 d2 74 06 48 8b 40 30 5d c3 31 c0 5d c3 66 90 0f 1f 44 00 00 55 48 8b 47 30 48 89 e5 <48> 8b 80 40 02 00 00 48 85 c0 74 02 5d c3 48 8b 57 78 8b 4a 20
[15138.197166] RIP: ovl_dentry_real+0xd/0x30 [overlay] RSP: ffffc9002365bac0
[15138.227629] CR2: 0000000000000240
[15138.242557] ---[ end trace b14367d5890a5990 ]---
[15138.267221] Kernel panic - not syncing: Fatal exception

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [4.13-rc1 regression] copyup crashes kernel when initializing selinux
  2017-07-17  9:37 [4.13-rc1 regression] copyup crashes kernel when initializing selinux Eryu Guan
@ 2017-07-17 11:25 ` Miklos Szeredi
  2017-07-17 12:12   ` Eryu Guan
  2017-07-17 14:42   ` Vivek Goyal
  0 siblings, 2 replies; 4+ messages in thread
From: Miklos Szeredi @ 2017-07-17 11:25 UTC (permalink / raw)
  To: Eryu Guan; +Cc: linux-unionfs, Miklos Szeredi

On Mon, Jul 17, 2017 at 05:37:41PM +0800, Eryu Guan wrote:
> Hi all,
> 
> I hit a kernel crash with 4.13-rc1 kernel when running fstests
> overlay/005. And git bisect pointed first bad to this commit
> 
> commit 09d8b586731bf589655c2ac971532c14cf272b63
> Author: Miklos Szeredi <mszeredi@redhat.com>
> Date:   Tue Jul 4 22:03:16 2017 +0200
> 
>     ovl: move __upperdentry to ovl_inode
> 
>     Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
> 
> inode_doinit_with_dentry wants to read the upper inode's xattr to get
> selinux information, and ovl_xattr_get() calls ovl_dentry_real(), which
> depends on dentry->d_inode, but d_inode is null and not initialized yet
> at this moment.
> 
> Mount overlay without selinux context mount option and trigger copyup
> could reproduce the crash reliably. (The crash log I appended is from a
> bisect run, so the kernel version is not exact 4.13-rc1.)

Could you please test following patch?

Thanks,
Miklos

---
 fs/overlayfs/inode.c     |   32 +++++++++++++++++---------------
 fs/overlayfs/overlayfs.h |    7 ++++---
 fs/overlayfs/super.c     |    8 ++++----
 fs/overlayfs/util.c      |    7 ++++++-
 4 files changed, 31 insertions(+), 23 deletions(-)

--- a/fs/overlayfs/inode.c
+++ b/fs/overlayfs/inode.c
@@ -202,37 +202,38 @@ bool ovl_is_private_xattr(const char *na
 		       sizeof(OVL_XATTR_PREFIX) - 1) == 0;
 }
 
-int ovl_xattr_set(struct dentry *dentry, const char *name, const void *value,
-		  size_t size, int flags)
+int ovl_xattr_set(struct dentry *dentry, struct inode *inode, const char *name,
+		  const void *value, size_t size, int flags)
 {
 	int err;
-	struct path realpath;
-	enum ovl_path_type type = ovl_path_real(dentry, &realpath);
+	struct dentry *upperdentry = ovl_i_dentry_upper(inode);
+	struct dentry *realdentry = upperdentry ?: ovl_dentry_lower(dentry);
 	const struct cred *old_cred;
 
 	err = ovl_want_write(dentry);
 	if (err)
 		goto out;
 
-	if (!value && !OVL_TYPE_UPPER(type)) {
-		err = vfs_getxattr(realpath.dentry, name, NULL, 0);
+	if (!value && !upperdentry) {
+		err = vfs_getxattr(realdentry, name, NULL, 0);
 		if (err < 0)
 			goto out_drop_write;
 	}
 
-	err = ovl_copy_up(dentry);
-	if (err)
-		goto out_drop_write;
+	if (!upperdentry) {
+		err = ovl_copy_up(dentry);
+		if (err)
+			goto out_drop_write;
 
-	if (!OVL_TYPE_UPPER(type))
-		ovl_path_upper(dentry, &realpath);
+		realdentry = ovl_dentry_upper(dentry);
+	}
 
 	old_cred = ovl_override_creds(dentry->d_sb);
 	if (value)
-		err = vfs_setxattr(realpath.dentry, name, value, size, flags);
+		err = vfs_setxattr(realdentry, name, value, size, flags);
 	else {
 		WARN_ON(flags != XATTR_REPLACE);
-		err = vfs_removexattr(realpath.dentry, name);
+		err = vfs_removexattr(realdentry, name);
 	}
 	revert_creds(old_cred);
 
@@ -242,12 +243,13 @@ int ovl_xattr_set(struct dentry *dentry,
 	return err;
 }
 
-int ovl_xattr_get(struct dentry *dentry, const char *name,
+int ovl_xattr_get(struct dentry *dentry, struct inode *inode, const char *name,
 		  void *value, size_t size)
 {
-	struct dentry *realdentry = ovl_dentry_real(dentry);
 	ssize_t res;
 	const struct cred *old_cred;
+	struct dentry *realdentry =
+		ovl_i_dentry_upper(inode) ?: ovl_dentry_lower(dentry);
 
 	old_cred = ovl_override_creds(dentry->d_sb);
 	res = vfs_getxattr(realdentry, name, value, size);
--- a/fs/overlayfs/overlayfs.h
+++ b/fs/overlayfs/overlayfs.h
@@ -199,6 +199,7 @@ enum ovl_path_type ovl_path_real(struct
 struct dentry *ovl_dentry_upper(struct dentry *dentry);
 struct dentry *ovl_dentry_lower(struct dentry *dentry);
 struct dentry *ovl_dentry_real(struct dentry *dentry);
+struct dentry *ovl_i_dentry_upper(struct inode *inode);
 struct inode *ovl_inode_upper(struct inode *inode);
 struct inode *ovl_inode_lower(struct inode *inode);
 struct inode *ovl_inode_real(struct inode *inode);
@@ -270,9 +271,9 @@ int ovl_setattr(struct dentry *dentry, s
 int ovl_getattr(const struct path *path, struct kstat *stat,
 		u32 request_mask, unsigned int flags);
 int ovl_permission(struct inode *inode, int mask);
-int ovl_xattr_set(struct dentry *dentry, const char *name, const void *value,
-		  size_t size, int flags);
-int ovl_xattr_get(struct dentry *dentry, const char *name,
+int ovl_xattr_set(struct dentry *dentry, struct inode *inode, const char *name,
+		  const void *value, size_t size, int flags);
+int ovl_xattr_get(struct dentry *dentry, struct inode *inode, const char *name,
 		  void *value, size_t size);
 ssize_t ovl_listxattr(struct dentry *dentry, char *list, size_t size);
 struct posix_acl *ovl_get_acl(struct inode *inode, int type);
--- a/fs/overlayfs/super.c
+++ b/fs/overlayfs/super.c
@@ -692,7 +692,7 @@ ovl_posix_acl_xattr_get(const struct xat
 			struct dentry *dentry, struct inode *inode,
 			const char *name, void *buffer, size_t size)
 {
-	return ovl_xattr_get(dentry, handler->name, buffer, size);
+	return ovl_xattr_get(dentry, inode, handler->name, buffer, size);
 }
 
 static int __maybe_unused
@@ -742,7 +742,7 @@ ovl_posix_acl_xattr_set(const struct xat
 			return err;
 	}
 
-	err = ovl_xattr_set(dentry, handler->name, value, size, flags);
+	err = ovl_xattr_set(dentry, inode, handler->name, value, size, flags);
 	if (!err)
 		ovl_copyattr(ovl_inode_real(inode), inode);
 
@@ -772,7 +772,7 @@ static int ovl_other_xattr_get(const str
 			       struct dentry *dentry, struct inode *inode,
 			       const char *name, void *buffer, size_t size)
 {
-	return ovl_xattr_get(dentry, name, buffer, size);
+	return ovl_xattr_get(dentry, inode, name, buffer, size);
 }
 
 static int ovl_other_xattr_set(const struct xattr_handler *handler,
@@ -780,7 +780,7 @@ static int ovl_other_xattr_set(const str
 			       const char *name, const void *value,
 			       size_t size, int flags)
 {
-	return ovl_xattr_set(dentry, name, value, size, flags);
+	return ovl_xattr_set(dentry, inode, name, value, size, flags);
 }
 
 static const struct xattr_handler __maybe_unused
--- a/fs/overlayfs/util.c
+++ b/fs/overlayfs/util.c
@@ -157,9 +157,14 @@ struct dentry *ovl_dentry_real(struct de
 	return ovl_dentry_upper(dentry) ?: ovl_dentry_lower(dentry);
 }
 
+struct dentry *ovl_i_dentry_upper(struct inode *inode)
+{
+	return ovl_upperdentry_dereference(OVL_I(inode));
+}
+
 struct inode *ovl_inode_upper(struct inode *inode)
 {
-	struct dentry *upperdentry = ovl_upperdentry_dereference(OVL_I(inode));
+	struct dentry *upperdentry = ovl_i_dentry_upper(inode);
 
 	return upperdentry ? d_inode(upperdentry) : NULL;
 }

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [4.13-rc1 regression] copyup crashes kernel when initializing selinux
  2017-07-17 11:25 ` Miklos Szeredi
@ 2017-07-17 12:12   ` Eryu Guan
  2017-07-17 14:42   ` Vivek Goyal
  1 sibling, 0 replies; 4+ messages in thread
From: Eryu Guan @ 2017-07-17 12:12 UTC (permalink / raw)
  To: Miklos Szeredi; +Cc: linux-unionfs, Miklos Szeredi

On Mon, Jul 17, 2017 at 01:25:03PM +0200, Miklos Szeredi wrote:
> On Mon, Jul 17, 2017 at 05:37:41PM +0800, Eryu Guan wrote:
> > Hi all,
> > 
> > I hit a kernel crash with 4.13-rc1 kernel when running fstests
> > overlay/005. And git bisect pointed first bad to this commit
> > 
> > commit 09d8b586731bf589655c2ac971532c14cf272b63
> > Author: Miklos Szeredi <mszeredi@redhat.com>
> > Date:   Tue Jul 4 22:03:16 2017 +0200
> > 
> >     ovl: move __upperdentry to ovl_inode
> > 
> >     Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
> > 
> > inode_doinit_with_dentry wants to read the upper inode's xattr to get
> > selinux information, and ovl_xattr_get() calls ovl_dentry_real(), which
> > depends on dentry->d_inode, but d_inode is null and not initialized yet
> > at this moment.
> > 
> > Mount overlay without selinux context mount option and trigger copyup
> > could reproduce the crash reliably. (The crash log I appended is from a
> > bisect run, so the kernel version is not exact 4.13-rc1.)
> 
> Could you please test following patch?

This patch works for me, but I just ran overlay/005, didn't run other
tests.

Thanks,
Eryu

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [4.13-rc1 regression] copyup crashes kernel when initializing selinux
  2017-07-17 11:25 ` Miklos Szeredi
  2017-07-17 12:12   ` Eryu Guan
@ 2017-07-17 14:42   ` Vivek Goyal
  1 sibling, 0 replies; 4+ messages in thread
From: Vivek Goyal @ 2017-07-17 14:42 UTC (permalink / raw)
  To: Miklos Szeredi; +Cc: Eryu Guan, linux-unionfs, Miklos Szeredi

On Mon, Jul 17, 2017 at 01:25:03PM +0200, Miklos Szeredi wrote:
> On Mon, Jul 17, 2017 at 05:37:41PM +0800, Eryu Guan wrote:
> > Hi all,
> > 
> > I hit a kernel crash with 4.13-rc1 kernel when running fstests
> > overlay/005. And git bisect pointed first bad to this commit
> > 
> > commit 09d8b586731bf589655c2ac971532c14cf272b63
> > Author: Miklos Szeredi <mszeredi@redhat.com>
> > Date:   Tue Jul 4 22:03:16 2017 +0200
> > 
> >     ovl: move __upperdentry to ovl_inode
> > 
> >     Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
> > 
> > inode_doinit_with_dentry wants to read the upper inode's xattr to get
> > selinux information, and ovl_xattr_get() calls ovl_dentry_real(), which
> > depends on dentry->d_inode, but d_inode is null and not initialized yet
> > at this moment.
> > 
> > Mount overlay without selinux context mount option and trigger copyup
> > could reproduce the crash reliably. (The crash log I appended is from a
> > bisect run, so the kernel version is not exact 4.13-rc1.)
> 
> Could you please test following patch?

For me even simple "ls" was failing after mounting overlayfs. This patch
seems to fix that.

Vivek

> 
> Thanks,
> Miklos
> 
> ---
>  fs/overlayfs/inode.c     |   32 +++++++++++++++++---------------
>  fs/overlayfs/overlayfs.h |    7 ++++---
>  fs/overlayfs/super.c     |    8 ++++----
>  fs/overlayfs/util.c      |    7 ++++++-
>  4 files changed, 31 insertions(+), 23 deletions(-)
> 
> --- a/fs/overlayfs/inode.c
> +++ b/fs/overlayfs/inode.c
> @@ -202,37 +202,38 @@ bool ovl_is_private_xattr(const char *na
>  		       sizeof(OVL_XATTR_PREFIX) - 1) == 0;
>  }
>  
> -int ovl_xattr_set(struct dentry *dentry, const char *name, const void *value,
> -		  size_t size, int flags)
> +int ovl_xattr_set(struct dentry *dentry, struct inode *inode, const char *name,
> +		  const void *value, size_t size, int flags)
>  {
>  	int err;
> -	struct path realpath;
> -	enum ovl_path_type type = ovl_path_real(dentry, &realpath);
> +	struct dentry *upperdentry = ovl_i_dentry_upper(inode);
> +	struct dentry *realdentry = upperdentry ?: ovl_dentry_lower(dentry);
>  	const struct cred *old_cred;
>  
>  	err = ovl_want_write(dentry);
>  	if (err)
>  		goto out;
>  
> -	if (!value && !OVL_TYPE_UPPER(type)) {
> -		err = vfs_getxattr(realpath.dentry, name, NULL, 0);
> +	if (!value && !upperdentry) {
> +		err = vfs_getxattr(realdentry, name, NULL, 0);
>  		if (err < 0)
>  			goto out_drop_write;
>  	}
>  
> -	err = ovl_copy_up(dentry);
> -	if (err)
> -		goto out_drop_write;
> +	if (!upperdentry) {
> +		err = ovl_copy_up(dentry);
> +		if (err)
> +			goto out_drop_write;
>  
> -	if (!OVL_TYPE_UPPER(type))
> -		ovl_path_upper(dentry, &realpath);
> +		realdentry = ovl_dentry_upper(dentry);
> +	}
>  
>  	old_cred = ovl_override_creds(dentry->d_sb);
>  	if (value)
> -		err = vfs_setxattr(realpath.dentry, name, value, size, flags);
> +		err = vfs_setxattr(realdentry, name, value, size, flags);
>  	else {
>  		WARN_ON(flags != XATTR_REPLACE);
> -		err = vfs_removexattr(realpath.dentry, name);
> +		err = vfs_removexattr(realdentry, name);
>  	}
>  	revert_creds(old_cred);
>  
> @@ -242,12 +243,13 @@ int ovl_xattr_set(struct dentry *dentry,
>  	return err;
>  }
>  
> -int ovl_xattr_get(struct dentry *dentry, const char *name,
> +int ovl_xattr_get(struct dentry *dentry, struct inode *inode, const char *name,
>  		  void *value, size_t size)
>  {
> -	struct dentry *realdentry = ovl_dentry_real(dentry);
>  	ssize_t res;
>  	const struct cred *old_cred;
> +	struct dentry *realdentry =
> +		ovl_i_dentry_upper(inode) ?: ovl_dentry_lower(dentry);
>  
>  	old_cred = ovl_override_creds(dentry->d_sb);
>  	res = vfs_getxattr(realdentry, name, value, size);
> --- a/fs/overlayfs/overlayfs.h
> +++ b/fs/overlayfs/overlayfs.h
> @@ -199,6 +199,7 @@ enum ovl_path_type ovl_path_real(struct
>  struct dentry *ovl_dentry_upper(struct dentry *dentry);
>  struct dentry *ovl_dentry_lower(struct dentry *dentry);
>  struct dentry *ovl_dentry_real(struct dentry *dentry);
> +struct dentry *ovl_i_dentry_upper(struct inode *inode);
>  struct inode *ovl_inode_upper(struct inode *inode);
>  struct inode *ovl_inode_lower(struct inode *inode);
>  struct inode *ovl_inode_real(struct inode *inode);
> @@ -270,9 +271,9 @@ int ovl_setattr(struct dentry *dentry, s
>  int ovl_getattr(const struct path *path, struct kstat *stat,
>  		u32 request_mask, unsigned int flags);
>  int ovl_permission(struct inode *inode, int mask);
> -int ovl_xattr_set(struct dentry *dentry, const char *name, const void *value,
> -		  size_t size, int flags);
> -int ovl_xattr_get(struct dentry *dentry, const char *name,
> +int ovl_xattr_set(struct dentry *dentry, struct inode *inode, const char *name,
> +		  const void *value, size_t size, int flags);
> +int ovl_xattr_get(struct dentry *dentry, struct inode *inode, const char *name,
>  		  void *value, size_t size);
>  ssize_t ovl_listxattr(struct dentry *dentry, char *list, size_t size);
>  struct posix_acl *ovl_get_acl(struct inode *inode, int type);
> --- a/fs/overlayfs/super.c
> +++ b/fs/overlayfs/super.c
> @@ -692,7 +692,7 @@ ovl_posix_acl_xattr_get(const struct xat
>  			struct dentry *dentry, struct inode *inode,
>  			const char *name, void *buffer, size_t size)
>  {
> -	return ovl_xattr_get(dentry, handler->name, buffer, size);
> +	return ovl_xattr_get(dentry, inode, handler->name, buffer, size);
>  }
>  
>  static int __maybe_unused
> @@ -742,7 +742,7 @@ ovl_posix_acl_xattr_set(const struct xat
>  			return err;
>  	}
>  
> -	err = ovl_xattr_set(dentry, handler->name, value, size, flags);
> +	err = ovl_xattr_set(dentry, inode, handler->name, value, size, flags);
>  	if (!err)
>  		ovl_copyattr(ovl_inode_real(inode), inode);
>  
> @@ -772,7 +772,7 @@ static int ovl_other_xattr_get(const str
>  			       struct dentry *dentry, struct inode *inode,
>  			       const char *name, void *buffer, size_t size)
>  {
> -	return ovl_xattr_get(dentry, name, buffer, size);
> +	return ovl_xattr_get(dentry, inode, name, buffer, size);
>  }
>  
>  static int ovl_other_xattr_set(const struct xattr_handler *handler,
> @@ -780,7 +780,7 @@ static int ovl_other_xattr_set(const str
>  			       const char *name, const void *value,
>  			       size_t size, int flags)
>  {
> -	return ovl_xattr_set(dentry, name, value, size, flags);
> +	return ovl_xattr_set(dentry, inode, name, value, size, flags);
>  }
>  
>  static const struct xattr_handler __maybe_unused
> --- a/fs/overlayfs/util.c
> +++ b/fs/overlayfs/util.c
> @@ -157,9 +157,14 @@ struct dentry *ovl_dentry_real(struct de
>  	return ovl_dentry_upper(dentry) ?: ovl_dentry_lower(dentry);
>  }
>  
> +struct dentry *ovl_i_dentry_upper(struct inode *inode)
> +{
> +	return ovl_upperdentry_dereference(OVL_I(inode));
> +}
> +
>  struct inode *ovl_inode_upper(struct inode *inode)
>  {
> -	struct dentry *upperdentry = ovl_upperdentry_dereference(OVL_I(inode));
> +	struct dentry *upperdentry = ovl_i_dentry_upper(inode);
>  
>  	return upperdentry ? d_inode(upperdentry) : NULL;
>  }
> --
> To unsubscribe from this list: send the line "unsubscribe linux-unionfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-07-17 14:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-17  9:37 [4.13-rc1 regression] copyup crashes kernel when initializing selinux Eryu Guan
2017-07-17 11:25 ` Miklos Szeredi
2017-07-17 12:12   ` Eryu Guan
2017-07-17 14:42   ` Vivek Goyal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox