apparmor: don't check for vmalloc_addr if kvzalloc() failed
authorJohn Johansen <john.johansen@canonical.com>
Wed, 15 Jun 2016 06:57:55 +0000 (09:57 +0300)
committerWilly Tarreau <w@1wt.eu>
Tue, 20 Jun 2017 12:04:12 +0000 (14:04 +0200)
commit 3197f5adf539a3ee6331f433a51483f8c842f890 upstream.

Signed-off-by: John Johansen <john.johansen@canonical.com>
Signed-off-by: Willy Tarreau <w@1wt.eu>
security/apparmor/match.c

index 630f325b87a84115cdd83c48c916f7ea602a52f9..10d824bc35772dbf13d51a67e4775713000da2d2 100644 (file)
@@ -73,14 +73,14 @@ static struct table_header *unpack_table(char *blob, size_t bsize)
                                     u32, be32_to_cpu);
                else
                        goto fail;
+               /* if table was vmalloced make sure the page tables are synced
+                * before it is used, as it goes live to all cpus.
+                */
+               if (is_vmalloc_addr(table))
+                       vm_unmap_aliases();
        }
 
 out:
-       /* if table was vmalloced make sure the page tables are synced
-        * before it is used, as it goes live to all cpus.
-        */
-       if (is_vmalloc_addr(table))
-               vm_unmap_aliases();
        return table;
 fail:
        kvfree(table);