lkml.org 
[lkml]   [2023]   [Nov]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Date
Subject[PATCH 15/16] commoncap: use vfs fscaps interfaces for killpriv checks
Signed-off-by: Seth Forshee (DigitalOcean) <sforshee@kernel.org>
---
security/commoncap.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/security/commoncap.c b/security/commoncap.c
index ced7a3c9685f..15344c86c759 100644
--- a/security/commoncap.c
+++ b/security/commoncap.c
@@ -295,11 +295,12 @@ int cap_capset(struct cred *new,
*/
int cap_inode_need_killpriv(struct dentry *dentry)
{
- struct inode *inode = d_backing_inode(dentry);
+ struct vfs_caps caps;
int error;

- error = __vfs_getxattr(dentry, inode, XATTR_NAME_CAPS, NULL, 0);
- return error > 0;
+ /* Use nop_mnt_idmap for no mapping here as mapping is unimportant */
+ error= __vfs_get_fscaps(&nop_mnt_idmap, dentry, &caps);
+ return error == 0;
}

/**
@@ -322,7 +323,7 @@ int cap_inode_killpriv(struct mnt_idmap *idmap, struct dentry *dentry)
{
int error;

- error = __vfs_removexattr(idmap, dentry, XATTR_NAME_CAPS);
+ error = __vfs_remove_fscaps(idmap, dentry);
if (error == -EOPNOTSUPP)
error = 0;
return error;
--
2.43.0

\
 
 \ /
  Last update: 2023-11-29 22:51    [W:0.303 / U:1.600 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site