Skip to content

Commit 9cfd403

Browse files
committed
Merge tag 'apparmor-pr-2018-01-07' of git://git.kernel.org/pub/scm/linux/kernel/git/jj/linux-apparmor
Pull apparmor fix from John Johansen: "This fixes a regression when the kernel feature set is reported as supporting mount and policy is pinned to a feature set that does not support mount mediation" * tag 'apparmor-pr-2018-01-07' of git://git.kernel.org/pub/scm/linux/kernel/git/jj/linux-apparmor: apparmor: fix regression in mount mediation when feature set is pinned
2 parents 9d61ec5 + 5b9f57c commit 9cfd403

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

security/apparmor/mount.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,9 @@ static int match_mnt_path_str(struct aa_profile *profile,
329329
AA_BUG(!mntpath);
330330
AA_BUG(!buffer);
331331

332+
if (!PROFILE_MEDIATES(profile, AA_CLASS_MOUNT))
333+
return 0;
334+
332335
error = aa_path_name(mntpath, path_flags(profile, mntpath), buffer,
333336
&mntpnt, &info, profile->disconnected);
334337
if (error)
@@ -380,6 +383,9 @@ static int match_mnt(struct aa_profile *profile, const struct path *path,
380383
AA_BUG(!profile);
381384
AA_BUG(devpath && !devbuffer);
382385

386+
if (!PROFILE_MEDIATES(profile, AA_CLASS_MOUNT))
387+
return 0;
388+
383389
if (devpath) {
384390
error = aa_path_name(devpath, path_flags(profile, devpath),
385391
devbuffer, &devname, &info,
@@ -558,6 +564,9 @@ static int profile_umount(struct aa_profile *profile, struct path *path,
558564
AA_BUG(!profile);
559565
AA_BUG(!path);
560566

567+
if (!PROFILE_MEDIATES(profile, AA_CLASS_MOUNT))
568+
return 0;
569+
561570
error = aa_path_name(path, path_flags(profile, path), buffer, &name,
562571
&info, profile->disconnected);
563572
if (error)
@@ -613,7 +622,8 @@ static struct aa_label *build_pivotroot(struct aa_profile *profile,
613622
AA_BUG(!new_path);
614623
AA_BUG(!old_path);
615624

616-
if (profile_unconfined(profile))
625+
if (profile_unconfined(profile) ||
626+
!PROFILE_MEDIATES(profile, AA_CLASS_MOUNT))
617627
return aa_get_newest_label(&profile->label);
618628

619629
error = aa_path_name(old_path, path_flags(profile, old_path),

0 commit comments

Comments
 (0)