aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2012-07-17 16:59:12 -0400
committerArnd Bergmann <arnd@arndb.de>2012-07-17 17:00:19 -0400
commita1acbbf4adcd346f12fc567143eac90ef33f29b0 (patch)
tree87b85a007a27f22958a4665536ad08962c53d6f7 /mm
parente190df2400db9ac749c77ffc054b8d8ec5cf3c47 (diff)
parent6bba0caf5883ebc1430df38551bbb77ce05d4659 (diff)
Merge branch 'next/board-samsung-2' of git://git.kernel.org/pub/scm/linux/kernel/git/kgene/linux-samsung into next/boards
From Kukjin Kim <kgene.kim@samsung.com>: The branch includes updating each Samsung boards such as SMDK4X12, Aquila, Goni and so on, and it is for audio platform device and supporting of HSOTG or framebuffer. * 'next/board-samsung-2' of git://git.kernel.org/pub/scm/linux/kernel/git/kgene/linux-samsung: ARM: EXYNOS: Add framebuffer support for SMDK4X12 ARM: EXYNOS: Add HSOTG support to SMDK4X12 ARM: S5PV210: Add audio platform device in Goni board ARM: S5PV210: Add audio platform device in Aquila board ARM: EXYNOS: Add audio platform device in SMDKV310 board ARM: S3C64XX: Don't specify an irq_base for WM1192-EV1 board Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'mm')
-rw-r--r--mm/madvise.c18
-rw-r--r--mm/shmem.c3
2 files changed, 16 insertions, 5 deletions
diff --git a/mm/madvise.c b/mm/madvise.c
index deff1b64a08c..14d260fa0d17 100644
--- a/mm/madvise.c
+++ b/mm/madvise.c
@@ -15,6 +15,7 @@
15#include <linux/sched.h> 15#include <linux/sched.h>
16#include <linux/ksm.h> 16#include <linux/ksm.h>
17#include <linux/fs.h> 17#include <linux/fs.h>
18#include <linux/file.h>
18 19
19/* 20/*
20 * Any behaviour which results in changes to the vma->vm_flags needs to 21 * Any behaviour which results in changes to the vma->vm_flags needs to
@@ -204,14 +205,16 @@ static long madvise_remove(struct vm_area_struct *vma,
204{ 205{
205 loff_t offset; 206 loff_t offset;
206 int error; 207 int error;
208 struct file *f;
207 209
208 *prev = NULL; /* tell sys_madvise we drop mmap_sem */ 210 *prev = NULL; /* tell sys_madvise we drop mmap_sem */
209 211
210 if (vma->vm_flags & (VM_LOCKED|VM_NONLINEAR|VM_HUGETLB)) 212 if (vma->vm_flags & (VM_LOCKED|VM_NONLINEAR|VM_HUGETLB))
211 return -EINVAL; 213 return -EINVAL;
212 214
213 if (!vma->vm_file || !vma->vm_file->f_mapping 215 f = vma->vm_file;
214 || !vma->vm_file->f_mapping->host) { 216
217 if (!f || !f->f_mapping || !f->f_mapping->host) {
215 return -EINVAL; 218 return -EINVAL;
216 } 219 }
217 220
@@ -221,11 +224,18 @@ static long madvise_remove(struct vm_area_struct *vma,
221 offset = (loff_t)(start - vma->vm_start) 224 offset = (loff_t)(start - vma->vm_start)
222 + ((loff_t)vma->vm_pgoff << PAGE_SHIFT); 225 + ((loff_t)vma->vm_pgoff << PAGE_SHIFT);
223 226
224 /* filesystem's fallocate may need to take i_mutex */ 227 /*
228 * Filesystem's fallocate may need to take i_mutex. We need to
229 * explicitly grab a reference because the vma (and hence the
230 * vma's reference to the file) can go away as soon as we drop
231 * mmap_sem.
232 */
233 get_file(f);
225 up_read(&current->mm->mmap_sem); 234 up_read(&current->mm->mmap_sem);
226 error = do_fallocate(vma->vm_file, 235 error = do_fallocate(f,
227 FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, 236 FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE,
228 offset, end - start); 237 offset, end - start);
238 fput(f);
229 down_read(&current->mm->mmap_sem); 239 down_read(&current->mm->mmap_sem);
230 return error; 240 return error;
231} 241}
diff --git a/mm/shmem.c b/mm/shmem.c
index a15a466d0d1d..4ce02e0673db 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -1594,6 +1594,7 @@ static ssize_t shmem_file_splice_read(struct file *in, loff_t *ppos,
1594 struct splice_pipe_desc spd = { 1594 struct splice_pipe_desc spd = {
1595 .pages = pages, 1595 .pages = pages,
1596 .partial = partial, 1596 .partial = partial,
1597 .nr_pages_max = PIPE_DEF_BUFFERS,
1597 .flags = flags, 1598 .flags = flags,
1598 .ops = &page_cache_pipe_buf_ops, 1599 .ops = &page_cache_pipe_buf_ops,
1599 .spd_release = spd_release_page, 1600 .spd_release = spd_release_page,
@@ -1682,7 +1683,7 @@ static ssize_t shmem_file_splice_read(struct file *in, loff_t *ppos,
1682 if (spd.nr_pages) 1683 if (spd.nr_pages)
1683 error = splice_to_pipe(pipe, &spd); 1684 error = splice_to_pipe(pipe, &spd);
1684 1685
1685 splice_shrink_spd(pipe, &spd); 1686 splice_shrink_spd(&spd);
1686 1687
1687 if (error > 0) { 1688 if (error > 0) {
1688 *ppos += error; 1689 *ppos += error;