Skip to content
/ linux Public

Commit f3cb5e5

Browse files
jrjohansengregkh
authored andcommitted
apparmor: drop in_atomic flag in common_mmap, and common_file_perm
[ Upstream commit c3f27cc ] with the previous changes to mmap the in_atomic flag is now always false, so drop it. Suggested-by: Tyler Hicks <code@tyhicks.com> Reviewed-by: Georgia Garcia <georgia.garcia@canonical.com> Signed-off-by: John Johansen <john.johansen@canonical.com> Stable-dep-of: 4a13472 ("apparmor: move check for aa_null file to cover all cases") Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 1eadeb4 commit f3cb5e5

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

security/apparmor/lsm.c

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -519,8 +519,7 @@ static void apparmor_file_free_security(struct file *file)
519519
aa_put_label(rcu_access_pointer(ctx->label));
520520
}
521521

522-
static int common_file_perm(const char *op, struct file *file, u32 mask,
523-
bool in_atomic)
522+
static int common_file_perm(const char *op, struct file *file, u32 mask)
524523
{
525524
struct aa_label *label;
526525
int error = 0;
@@ -531,21 +530,20 @@ static int common_file_perm(const char *op, struct file *file, u32 mask,
531530
return -EACCES;
532531

533532
label = __begin_current_label_crit_section(&needput);
534-
error = aa_file_perm(op, current_cred(), label, file, mask, in_atomic);
533+
error = aa_file_perm(op, current_cred(), label, file, mask, false);
535534
__end_current_label_crit_section(label, needput);
536535

537536
return error;
538537
}
539538

540539
static int apparmor_file_receive(struct file *file)
541540
{
542-
return common_file_perm(OP_FRECEIVE, file, aa_map_file_to_perms(file),
543-
false);
541+
return common_file_perm(OP_FRECEIVE, file, aa_map_file_to_perms(file));
544542
}
545543

546544
static int apparmor_file_permission(struct file *file, int mask)
547545
{
548-
return common_file_perm(OP_FPERM, file, mask, false);
546+
return common_file_perm(OP_FPERM, file, mask);
549547
}
550548

551549
static int apparmor_file_lock(struct file *file, unsigned int cmd)
@@ -555,11 +553,11 @@ static int apparmor_file_lock(struct file *file, unsigned int cmd)
555553
if (cmd == F_WRLCK)
556554
mask |= MAY_WRITE;
557555

558-
return common_file_perm(OP_FLOCK, file, mask, false);
556+
return common_file_perm(OP_FLOCK, file, mask);
559557
}
560558

561559
static int common_mmap(const char *op, struct file *file, unsigned long prot,
562-
unsigned long flags, bool in_atomic)
560+
unsigned long flags)
563561
{
564562
int mask = 0;
565563

@@ -577,21 +575,20 @@ static int common_mmap(const char *op, struct file *file, unsigned long prot,
577575
if (prot & PROT_EXEC)
578576
mask |= AA_EXEC_MMAP;
579577

580-
return common_file_perm(op, file, mask, in_atomic);
578+
return common_file_perm(op, file, mask);
581579
}
582580

583581
static int apparmor_mmap_file(struct file *file, unsigned long reqprot,
584582
unsigned long prot, unsigned long flags)
585583
{
586-
return common_mmap(OP_FMMAP, file, prot, flags, false);
584+
return common_mmap(OP_FMMAP, file, prot, flags);
587585
}
588586

589587
static int apparmor_file_mprotect(struct vm_area_struct *vma,
590588
unsigned long reqprot, unsigned long prot)
591589
{
592590
return common_mmap(OP_FMPROT, vma->vm_file, prot,
593-
!(vma->vm_flags & VM_SHARED) ? MAP_PRIVATE : 0,
594-
false);
591+
!(vma->vm_flags & VM_SHARED) ? MAP_PRIVATE : 0);
595592
}
596593

597594
#ifdef CONFIG_IO_URING

0 commit comments

Comments
 (0)