protect get_user_pages with mmap_sem before_interruptible
authorMiklos Szeredi <miklos@szeredi.hu>
Tue, 7 Dec 2004 20:13:47 +0000 (20:13 +0000)
committerMiklos Szeredi <miklos@szeredi.hu>
Tue, 7 Dec 2004 20:13:47 +0000 (20:13 +0000)
kernel/file.c

index 11a7ee828a0c417fd5979372edccb29c5ddc3aae..738f1f030518066b2e688e053cd9806cbac8a9aa 100644 (file)
@@ -658,8 +658,10 @@ static int fuse_get_user_pages(struct fuse_req *req, const char __user *buf,
        nbytes = min(nbytes, (unsigned) FUSE_MAX_PAGES_PER_REQ << PAGE_SHIFT);
        npages = (nbytes + offset + PAGE_SIZE - 1) >> PAGE_SHIFT;
        npages = min(npages, FUSE_MAX_PAGES_PER_REQ);
+       down_read(&current->mm->mmap_sem);
        npages = get_user_pages(current, current->mm, user_addr, npages, write,
                                0, req->pages, NULL);
+       up_read(&current->mm->mmap_sem);
        if (npages < 0)
                return npages;