Revert "fs: Fix file_set_fowner LSM hook inconsistencies"

This reverts commit 33a22518e4.
This commit is contained in:
Ksawlii 2024-11-24 00:23:15 +01:00
parent 40cd6892ab
commit 831814b413

View file

@ -100,8 +100,8 @@ static int setfl(int fd, struct file * filp, unsigned long arg)
return error;
}
void __f_setown(struct file *filp, struct pid *pid, enum pid_type type,
int force)
static void f_modown(struct file *filp, struct pid *pid, enum pid_type type,
int force)
{
write_lock_irq(&filp->f_owner.lock);
if (force || !filp->f_owner.pid) {
@ -111,13 +111,19 @@ void __f_setown(struct file *filp, struct pid *pid, enum pid_type type,
if (pid) {
const struct cred *cred = current_cred();
security_file_set_fowner(filp);
filp->f_owner.uid = cred->uid;
filp->f_owner.euid = cred->euid;
}
}
write_unlock_irq(&filp->f_owner.lock);
}
void __f_setown(struct file *filp, struct pid *pid, enum pid_type type,
int force)
{
security_file_set_fowner(filp);
f_modown(filp, pid, type, force);
}
EXPORT_SYMBOL(__f_setown);
int f_setown(struct file *filp, unsigned long arg, int force)
@ -153,7 +159,7 @@ EXPORT_SYMBOL(f_setown);
void f_delown(struct file *filp)
{
__f_setown(filp, NULL, PIDTYPE_TGID, 1);
f_modown(filp, NULL, PIDTYPE_TGID, 1);
}
pid_t f_getown(struct file *filp)