[06/11] UBUNTU: SAUCE: apparmor: fix oops in bind_mnt when dev_path lookup fails

Message ID 20170331125744.16986-7-john.johansen@canonical.com
State New
Headers show

Commit Message

John Johansen March 31, 2017, 12:57 p.m.
Bind mounts can oops when devname lookup fails because the devname is
uninitialized and used in auditing the denial.

BugLink: http://bugs.launchpad.net/bugs/1660840
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Tim Gardner <tim.gardner@canonical.com>
Acked-by: Brad Figg <brad.figg@canonical.com>
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
 security/apparmor/mount.c | 1 +
 1 file changed, 1 insertion(+)


diff --git a/security/apparmor/mount.c b/security/apparmor/mount.c
index 907d3f0..e780181 100644
--- a/security/apparmor/mount.c
+++ b/security/apparmor/mount.c
@@ -335,6 +335,7 @@  static int match_mnt_path_str(struct aa_profile *profile, const struct path *mnt
 		goto audit;
 	if (IS_ERR(devname)) {
 		error = PTR_ERR(devname);
+		devname = NULL;
 		info = devinfo;
 		goto audit;