diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2026-06-17 12:34:16 +0100 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2026-06-17 12:34:16 +0100 |
| commit | 87599bd29856ea7bfdd62591c581c8be5a4719ee (patch) | |
| tree | b923cec03ce2948444147a1424ebbc3d4b2be48e /fs | |
| parent | 5b33fc6492a7b7a62359157db0f92f5b6e9af690 (diff) | |
| parent | f71ece9712b7712df98871eea9aeb60e49ca5239 (diff) | |
Merge tag 'lsm-pr-20260615' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/lsm
Pull lsm update from Paul Moore:
"A single LSM update the security_inode_listsecurity() hook to be able
to leverage the xattr_list_one() helper function.
We wanted to do this for a while, but we needed to fixup the callers
in the NFS code first. With the NFS code changes shipping in Linux
v7.0 and no one complaining, it seemed a good time to complete the
shift"
* tag 'lsm-pr-20260615' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/lsm:
security,fs,nfs,net: update security_inode_listsecurity() interface
Diffstat (limited to 'fs')
| -rw-r--r-- | fs/nfs/nfs4proc.c | 7 | ||||
| -rw-r--r-- | fs/xattr.c | 11 |
2 files changed, 9 insertions, 9 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 0715a6745d1f..c48281db3868 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -10564,13 +10564,10 @@ static ssize_t nfs4_listxattr(struct dentry *dentry, char *list, size_t size) left -= error; } - error2 = security_inode_listsecurity(d_inode(dentry), list, left); + error2 = security_inode_listsecurity(d_inode(dentry), &list, &left); if (error2 < 0) return error2; - if (list) { - list += error2; - left -= error2; - } + error2 = size - error - left; error3 = nfs4_listxattr_nfs4_user(d_inode(dentry), list, left); if (error3 < 0) diff --git a/fs/xattr.c b/fs/xattr.c index e1fc688158eb..d58979115200 100644 --- a/fs/xattr.c +++ b/fs/xattr.c @@ -515,9 +515,12 @@ vfs_listxattr(struct dentry *dentry, char *list, size_t size) if (inode->i_op->listxattr) { error = inode->i_op->listxattr(dentry, list, size); } else { - error = security_inode_listsecurity(inode, list, size); - if (size && error > size) - error = -ERANGE; + ssize_t remaining = size; + + error = security_inode_listsecurity(inode, &list, &remaining); + if (error) + return error; + error = size - remaining; } return error; } @@ -1612,7 +1615,7 @@ ssize_t simple_xattr_list(struct inode *inode, struct list_head *xattrs, if (err) return err; - err = security_inode_listsecurity(inode, buffer, remaining_size); + err = security_inode_listsecurity(inode, &buffer, &remaining_size); if (err < 0) return err; |
