]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
shm-fix-null-pointer-deref-when-userspace-specifies-invalid-hugepage-size-fix
authorAndrew Morton <akpm@linux-foundation.org>
Thu, 23 May 2013 00:36:47 +0000 (10:36 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Mon, 27 May 2013 06:07:51 +0000 (16:07 +1000)
eliminate ugly 80-col tricks

Cc: Dave Jones <davej@redhat.com>
Cc: Davidlohr Bueso <davidlohr.bueso@hp.com>
Cc: Li Zefan <lizefan@huawei.com>
Cc: Li Zefan <lizfan@huawei.com>
Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Cc: Rik van Riel <riel@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
ipc/shm.c
mm/mmap.c

index 7e199fa1960f86087c557bcc39b08d304c2b8f7b..85dc001634b1bb6cb63604f79178205504f73aca 100644 (file)
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -491,10 +491,10 @@ static int newseg(struct ipc_namespace *ns, struct ipc_params *params)
 
        sprintf (name, "SYSV%08x", key);
        if (shmflg & SHM_HUGETLB) {
-               struct hstate *hs = hstate_sizelog((shmflg >> SHM_HUGE_SHIFT)
-                                               & SHM_HUGE_MASK);
+               struct hstate *hs;
                size_t hugesize;
 
+               hs = hstate_sizelog((shmflg >> SHM_HUGE_SHIFT) & SHM_HUGE_MASK);
                if (!hs) {
                        error = -EINVAL;
                        goto no_file;
index f681e1842fadc1ccd8d7188a7ca1688c73548111..ec75bb0681f97e2f4996a94a2a8c465f37544fc0 100644 (file)
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -1367,9 +1367,9 @@ SYSCALL_DEFINE6(mmap_pgoff, unsigned long, addr, unsigned long, len,
                        len = ALIGN(len, huge_page_size(hstate_file(file)));
        } else if (flags & MAP_HUGETLB) {
                struct user_struct *user = NULL;
-               struct hstate *hs = hstate_sizelog((flags >> MAP_HUGE_SHIFT) &
-                                                  SHM_HUGE_MASK);
+               struct hstate *hs;
 
+               hs = hstate_sizelog((flags >> MAP_HUGE_SHIFT) & SHM_HUGE_MASK);
                if (!hs)
                        return -EINVAL;