usb: gadget: f_hid: fix report descriptor allocation
[platform/kernel/linux-starfive.git] / fs / binfmt_elf.c
index 63c7ebb..e6c9c0e 100644 (file)
@@ -315,10 +315,10 @@ create_elf_tables(struct linux_binprm *bprm, const struct elfhdr *exec,
         * Grow the stack manually; some architectures have a limit on how
         * far ahead a user-space access may be in order to grow the stack.
         */
-       if (mmap_read_lock_killable(mm))
+       if (mmap_write_lock_killable(mm))
                return -EINTR;
-       vma = find_extend_vma(mm, bprm->p);
-       mmap_read_unlock(mm);
+       vma = find_extend_vma_locked(mm, bprm->p);
+       mmap_write_unlock(mm);
        if (!vma)
                return -EFAULT;
 
@@ -911,7 +911,7 @@ static int load_elf_binary(struct linux_binprm *bprm)
                interp_elf_ex = kmalloc(sizeof(*interp_elf_ex), GFP_KERNEL);
                if (!interp_elf_ex) {
                        retval = -ENOMEM;
-                       goto out_free_ph;
+                       goto out_free_file;
                }
 
                /* Get the exec headers */
@@ -1354,6 +1354,7 @@ out:
 out_free_dentry:
        kfree(interp_elf_ex);
        kfree(interp_elf_phdata);
+out_free_file:
        allow_write_access(interpreter);
        if (interpreter)
                fput(interpreter);
@@ -2208,7 +2209,7 @@ static int elf_core_dump(struct coredump_params *cprm)
         * The number of segs are recored into ELF header as 16bit value.
         * Please check DEFAULT_MAX_MAP_COUNT definition when you modify here.
         */
-       segs = cprm->vma_count + elf_core_extra_phdrs();
+       segs = cprm->vma_count + elf_core_extra_phdrs(cprm);
 
        /* for notes section */
        segs++;
@@ -2248,7 +2249,7 @@ static int elf_core_dump(struct coredump_params *cprm)
        dataoff = offset = roundup(offset, ELF_EXEC_PAGESIZE);
 
        offset += cprm->vma_data_size;
-       offset += elf_core_extra_data_size();
+       offset += elf_core_extra_data_size(cprm);
        e_shoff = offset;
 
        if (e_phnum == PN_XNUM) {