mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-24 14:07:52 -04:00
fs: add file and path permissions helpers
Add two simple helpers to check permissions on a file and path respectively and convert over some callers. It simplifies quite a few codepaths and also reduces the churn in later patches quite a bit. Christoph also correctly points out that this makes codepaths (e.g. ioctls) way easier to follow that would otherwise have to do more complex argument passing than necessary. Link: https://lore.kernel.org/r/20210121131959.646623-4-christian.brauner@ubuntu.com Cc: David Howells <dhowells@redhat.com> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: linux-fsdevel@vger.kernel.org Suggested-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: James Morris <jamorris@linux.microsoft.com> Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
This commit is contained in:
parent
e6c9a71451
commit
02f92b3868
13 changed files with 24 additions and 16 deletions
|
@ -936,7 +936,7 @@ static struct sock *unix_find_other(struct net *net,
|
|||
if (err)
|
||||
goto fail;
|
||||
inode = d_backing_inode(path.dentry);
|
||||
err = inode_permission(inode, MAY_WRITE);
|
||||
err = path_permission(&path, MAY_WRITE);
|
||||
if (err)
|
||||
goto put_fail;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue