+ m68k-call-find_vma-with-the-mmap_sem-held-in-sys_cacheflush-v2.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     Subject: m68k-call-find_vma-with-the-mmap_sem-held-in-sys_cacheflush-v2
has been added to the -mm tree.  Its filename is
     m68k-call-find_vma-with-the-mmap_sem-held-in-sys_cacheflush-v2.patch

This patch should soon appear at
    http://ozlabs.org/~akpm/mmots/broken-out/m68k-call-find_vma-with-the-mmap_sem-held-in-sys_cacheflush-v2.patch
and later at
    http://ozlabs.org/~akpm/mmotm/broken-out/m68k-call-find_vma-with-the-mmap_sem-held-in-sys_cacheflush-v2.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/SubmitChecklist when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: Davidlohr Bueso <davidlohr@xxxxxx>
Subject: m68k-call-find_vma-with-the-mmap_sem-held-in-sys_cacheflush-v2

So I wasn't sure if we *really* required to serialize the entire address
space for this operation. However, looking at other archs, sh seems to
do exactly that, so I guess, at least for safety, we should hold the
lock until we exit the function. I guess taking it as a reader enables
us to guarantee it won't be removed underneath us. So here's v2.

Signed-off-by: Davidlohr Bueso <davidlohr@xxxxxx>
Cc: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 arch/m68k/kernel/sys_m68k.c |   11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff -puN arch/m68k/kernel/sys_m68k.c~m68k-call-find_vma-with-the-mmap_sem-held-in-sys_cacheflush-v2 arch/m68k/kernel/sys_m68k.c
--- a/arch/m68k/kernel/sys_m68k.c~m68k-call-find_vma-with-the-mmap_sem-held-in-sys_cacheflush-v2
+++ a/arch/m68k/kernel/sys_m68k.c
@@ -389,7 +389,6 @@ sys_cacheflush (unsigned long addr, int
 			goto out;
 	} else {
 		struct vm_area_struct *vma;
-		bool invalid;
 
 		/* Check for overflow.  */
 		if (addr + len < addr)
@@ -402,10 +401,8 @@ sys_cacheflush (unsigned long addr, int
 		ret = -EINVAL;
 		down_read(&current->mm->mmap_sem);
 		vma = find_vma(current->mm, addr);
-		invalid = !vma || addr < vma->vm_start || addr + len > vma->vm_end;
-		up_read(&current->mm->mmap_sem);
-		if (invalid)
-			goto out;
+		if (!vma || addr < vma->vm_start || addr + len > vma->vm_end)
+			goto out_unlock;
 	}
 
 	if (CPU_IS_020_OR_030) {
@@ -435,7 +432,7 @@ sys_cacheflush (unsigned long addr, int
 			__asm__ __volatile__ ("movec %0, %%cacr" : : "r" (cacr));
 		}
 		ret = 0;
-		goto out;
+		goto out_unlock;
 	} else {
 	    /*
 	     * 040 or 060: don't blindly trust 'scope', someone could
@@ -452,6 +449,8 @@ sys_cacheflush (unsigned long addr, int
 		ret = cache_flush_060 (addr, scope, cache, len);
 	    }
 	}
+out_unlock:
+	up_read(&current->mm->mmap_sem);
 out:
 	return ret;
 }
_

Patches currently in -mm which might be from davidlohr@xxxxxx are

origin.patch
m68k-call-find_vma-with-the-mmap_sem-held-in-sys_cacheflush.patch
m68k-call-find_vma-with-the-mmap_sem-held-in-sys_cacheflush-v2.patch
shm-make-exit_shm-work-proportional-to-task-activity.patch
shm-allow-exit_shm-in-parallel-if-only-marking-orphans.patch
shm-remove-unneeded-extern-for-function.patch
linux-next.patch

--
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux