From c45d1a66b86c3e274113fdf30ab39ad2c2a69179 Mon Sep 17 00:00:00 2001 From: Miklos Szeredi Date: Tue, 7 Dec 2004 20:13:47 +0000 Subject: [PATCH] protect get_user_pages with mmap_sem --- kernel/file.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/file.c b/kernel/file.c index 11a7ee8..738f1f0 100644 --- a/kernel/file.c +++ b/kernel/file.c @@ -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(¤t->mm->mmap_sem); npages = get_user_pages(current, current->mm, user_addr, npages, write, 0, req->pages, NULL); + up_read(¤t->mm->mmap_sem); if (npages < 0) return npages; -- 2.30.2