aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
Diffstat (limited to 'mm')
-rw-r--r--mm/filemap.c10
-rw-r--r--mm/filemap_xip.c2
-rw-r--r--mm/vmalloc.c3
3 files changed, 10 insertions, 5 deletions
diff --git a/mm/filemap.c b/mm/filemap.c
index 23acefe51808..60fd56772cc6 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -1816,14 +1816,14 @@ EXPORT_SYMBOL(file_remove_suid);
1816static size_t __iovec_copy_from_user_inatomic(char *vaddr, 1816static size_t __iovec_copy_from_user_inatomic(char *vaddr,
1817 const struct iovec *iov, size_t base, size_t bytes) 1817 const struct iovec *iov, size_t base, size_t bytes)
1818{ 1818{
1819 size_t copied = 0, left = 0; 1819 size_t copied = 0, left = 0, total = bytes;
1820 1820
1821 while (bytes) { 1821 while (bytes) {
1822 char __user *buf = iov->iov_base + base; 1822 char __user *buf = iov->iov_base + base;
1823 int copy = min(bytes, iov->iov_len - base); 1823 int copy = min(bytes, iov->iov_len - base);
1824 1824
1825 base = 0; 1825 base = 0;
1826 left = __copy_from_user_inatomic_nocache(vaddr, buf, copy); 1826 left = __copy_from_user_inatomic_nocache(vaddr, buf, copy, total);
1827 copied += copy; 1827 copied += copy;
1828 bytes -= copy; 1828 bytes -= copy;
1829 vaddr += copy; 1829 vaddr += copy;
@@ -1851,8 +1851,9 @@ size_t iov_iter_copy_from_user_atomic(struct page *page,
1851 if (likely(i->nr_segs == 1)) { 1851 if (likely(i->nr_segs == 1)) {
1852 int left; 1852 int left;
1853 char __user *buf = i->iov->iov_base + i->iov_offset; 1853 char __user *buf = i->iov->iov_base + i->iov_offset;
1854
1854 left = __copy_from_user_inatomic_nocache(kaddr + offset, 1855 left = __copy_from_user_inatomic_nocache(kaddr + offset,
1855 buf, bytes); 1856 buf, bytes, bytes);
1856 copied = bytes - left; 1857 copied = bytes - left;
1857 } else { 1858 } else {
1858 copied = __iovec_copy_from_user_inatomic(kaddr + offset, 1859 copied = __iovec_copy_from_user_inatomic(kaddr + offset,
@@ -1880,7 +1881,8 @@ size_t iov_iter_copy_from_user(struct page *page,
1880 if (likely(i->nr_segs == 1)) { 1881 if (likely(i->nr_segs == 1)) {
1881 int left; 1882 int left;
1882 char __user *buf = i->iov->iov_base + i->iov_offset; 1883 char __user *buf = i->iov->iov_base + i->iov_offset;
1883 left = __copy_from_user_nocache(kaddr + offset, buf, bytes); 1884
1885 left = __copy_from_user_nocache(kaddr + offset, buf, bytes, bytes);
1884 copied = bytes - left; 1886 copied = bytes - left;
1885 } else { 1887 } else {
1886 copied = __iovec_copy_from_user_inatomic(kaddr + offset, 1888 copied = __iovec_copy_from_user_inatomic(kaddr + offset,
diff --git a/mm/filemap_xip.c b/mm/filemap_xip.c
index 0c04615651b7..bf54f8a2cf1d 100644
--- a/mm/filemap_xip.c
+++ b/mm/filemap_xip.c
@@ -354,7 +354,7 @@ __xip_file_write(struct file *filp, const char __user *buf,
354 break; 354 break;
355 355
356 copied = bytes - 356 copied = bytes -
357 __copy_from_user_nocache(xip_mem + offset, buf, bytes); 357 __copy_from_user_nocache(xip_mem + offset, buf, bytes, bytes);
358 358
359 if (likely(copied > 0)) { 359 if (likely(copied > 0)) {
360 status = copied; 360 status = copied;
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index 903cad46e796..7774c6328970 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -1259,6 +1259,7 @@ EXPORT_SYMBOL(vfree);
1259void vunmap(const void *addr) 1259void vunmap(const void *addr)
1260{ 1260{
1261 BUG_ON(in_interrupt()); 1261 BUG_ON(in_interrupt());
1262 might_sleep();
1262 __vunmap(addr, 0); 1263 __vunmap(addr, 0);
1263} 1264}
1264EXPORT_SYMBOL(vunmap); 1265EXPORT_SYMBOL(vunmap);
@@ -1278,6 +1279,8 @@ void *vmap(struct page **pages, unsigned int count,
1278{ 1279{
1279 struct vm_struct *area; 1280 struct vm_struct *area;
1280 1281
1282 might_sleep();
1283
1281 if (count > num_physpages) 1284 if (count > num_physpages)
1282 return NULL; 1285 return NULL;
1283 1286