mirror of
https://github.com/torvalds/linux.git
synced 2026-05-31 18:43:33 +02:00
ovl: port ovl_do_remove() to cred guard
Use the scoped ovl cred guard. Link: https://patch.msgid.link/20251117-work-ovl-cred-guard-v4-5-b31603935724@kernel.org Reviewed-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
parent
ff4f6e4689
commit
8368eb837e
|
|
@ -907,7 +907,6 @@ static void ovl_drop_nlink(struct dentry *dentry)
|
|||
static int ovl_do_remove(struct dentry *dentry, bool is_dir)
|
||||
{
|
||||
int err;
|
||||
const struct cred *old_cred;
|
||||
bool lower_positive = ovl_lower_positive(dentry);
|
||||
LIST_HEAD(list);
|
||||
|
||||
|
|
@ -926,12 +925,12 @@ static int ovl_do_remove(struct dentry *dentry, bool is_dir)
|
|||
if (err)
|
||||
goto out;
|
||||
|
||||
old_cred = ovl_override_creds(dentry->d_sb);
|
||||
if (!lower_positive)
|
||||
err = ovl_remove_upper(dentry, is_dir, &list);
|
||||
else
|
||||
err = ovl_remove_and_whiteout(dentry, &list);
|
||||
ovl_revert_creds(old_cred);
|
||||
with_ovl_creds(dentry->d_sb) {
|
||||
if (!lower_positive)
|
||||
err = ovl_remove_upper(dentry, is_dir, &list);
|
||||
else
|
||||
err = ovl_remove_and_whiteout(dentry, &list);
|
||||
}
|
||||
if (!err) {
|
||||
if (is_dir)
|
||||
clear_nlink(dentry->d_inode);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user