aboutsummaryrefslogtreecommitdiffstats
path: root/fs/inode.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-09-05 07:53:56 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-09-05 07:53:56 +0200
commit50e177c5bfd9abc3828cb57e14e6169170f6764a (patch)
tree180aafa376fb7a0a89c7d6812f640f8c46758bd5 /fs/inode.c
parentmisc: microchip: pci1xxxx: Add power management functions - suspend & resume handlers. (diff)
parentLinux 6.0-rc4 (diff)
downloadlinux-dev-50e177c5bfd9abc3828cb57e14e6169170f6764a.tar.xz
linux-dev-50e177c5bfd9abc3828cb57e14e6169170f6764a.zip
Merge 6.0-rc4 into char-misc-next
We need the char-misc fixes in here as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/inode.c')
-rw-r--r--fs/inode.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/fs/inode.c b/fs/inode.c
index 6462276dfdf0..ba1de23c13c1 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -2018,23 +2018,25 @@ static int __file_remove_privs(struct file *file, unsigned int flags)
{
struct dentry *dentry = file_dentry(file);
struct inode *inode = file_inode(file);
- int error;
+ int error = 0;
int kill;
if (IS_NOSEC(inode) || !S_ISREG(inode->i_mode))
return 0;
kill = dentry_needs_remove_privs(dentry);
- if (kill <= 0)
+ if (kill < 0)
return kill;
- if (flags & IOCB_NOWAIT)
- return -EAGAIN;
+ if (kill) {
+ if (flags & IOCB_NOWAIT)
+ return -EAGAIN;
+
+ error = __remove_privs(file_mnt_user_ns(file), dentry, kill);
+ }
- error = __remove_privs(file_mnt_user_ns(file), dentry, kill);
if (!error)
inode_has_no_xattr(inode);
-
return error;
}