OSDN Git Service

Merge tag 'v4.4.207' into 10
[sagit-ice-cold/kernel_xiaomi_msm8998.git] / mm / shmem.c
index 75e1d68..358b133 100644 (file)
@@ -1499,7 +1499,7 @@ shmem_write_begin(struct file *file, struct address_space *mapping,
        pgoff_t index = pos >> PAGE_CACHE_SHIFT;
 
        /* i_mutex is held by caller */
-       if (unlikely(info->seals)) {
+       if (unlikely(info->seals & (F_SEAL_WRITE | F_SEAL_GROW))) {
                if (info->seals & F_SEAL_WRITE)
                        return -EPERM;
                if ((info->seals & F_SEAL_GROW) && pos + len > inode->i_size)
@@ -1862,7 +1862,7 @@ static void shmem_tag_pins(struct address_space *mapping)
        spin_lock_irq(&mapping->tree_lock);
 restart:
        radix_tree_for_each_slot(slot, &mapping->page_tree, &iter, start) {
-               page = radix_tree_deref_slot(slot);
+               page = radix_tree_deref_slot_protected(slot, &mapping->tree_lock);
                if (!page || radix_tree_exception(page)) {
                        if (radix_tree_deref_retry(page))
                                goto restart;
@@ -2092,7 +2092,7 @@ static long shmem_fallocate(struct file *file, int mode, loff_t offset,
                }
 
                shmem_falloc.waitq = &shmem_falloc_waitq;
-               shmem_falloc.start = unmap_start >> PAGE_SHIFT;
+               shmem_falloc.start = (u64)unmap_start >> PAGE_SHIFT;
                shmem_falloc.next = (unmap_end + 1) >> PAGE_SHIFT;
                spin_lock(&inode->i_lock);
                inode->i_private = &shmem_falloc;