mirror of
https://github.com/torvalds/linux.git
synced 2026-06-01 19:13:47 +02:00
fs/open: make chmod_common() and chown_common() killable
Allows killing processes that are waiting for the inode lock. Signed-off-by: Max Kellermann <max.kellermann@ionos.com> Link: https://lore.kernel.org/20250513150327.1373061-2-max.kellermann@ionos.com Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
parent
d8c5507cd1
commit
28a3f6ab2f
|
|
@ -635,7 +635,9 @@ int chmod_common(const struct path *path, umode_t mode)
|
|||
if (error)
|
||||
return error;
|
||||
retry_deleg:
|
||||
inode_lock(inode);
|
||||
error = inode_lock_killable(inode);
|
||||
if (error)
|
||||
goto out_mnt_unlock;
|
||||
error = security_path_chmod(path, mode);
|
||||
if (error)
|
||||
goto out_unlock;
|
||||
|
|
@ -650,6 +652,7 @@ int chmod_common(const struct path *path, umode_t mode)
|
|||
if (!error)
|
||||
goto retry_deleg;
|
||||
}
|
||||
out_mnt_unlock:
|
||||
mnt_drop_write(path->mnt);
|
||||
return error;
|
||||
}
|
||||
|
|
@ -769,7 +772,9 @@ int chown_common(const struct path *path, uid_t user, gid_t group)
|
|||
return -EINVAL;
|
||||
if ((group != (gid_t)-1) && !setattr_vfsgid(&newattrs, gid))
|
||||
return -EINVAL;
|
||||
inode_lock(inode);
|
||||
error = inode_lock_killable(inode);
|
||||
if (error)
|
||||
return error;
|
||||
if (!S_ISDIR(inode->i_mode))
|
||||
newattrs.ia_valid |= ATTR_KILL_SUID | ATTR_KILL_PRIV |
|
||||
setattr_should_drop_sgid(idmap, inode);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user