The patch titled Subject: mm-gup-fix-memory-leak-in-__gup_benchmark_ioctl-fix has been added to the -mm tree. Its filename is mm-gup-fix-memory-leak-in-__gup_benchmark_ioctl-fix.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/mm-gup-fix-memory-leak-in-__gup_benchmark_ioctl-fix.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/mm-gup-fix-memory-leak-in-__gup_benchmark_ioctl-fix.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> Subject: mm-gup-fix-memory-leak-in-__gup_benchmark_ioctl-fix rework code flow, return -EINVAL rather than -1 Cc: Dan Williams <dan.j.williams@xxxxxxxxx> Cc: Dave Hansen <dave.hansen@xxxxxxxxx> Cc: Ira Weiny <ira.weiny@xxxxxxxxx> Cc: Keith Busch <keith.busch@xxxxxxxxx> Cc: Kirill A. Shutemov <kirill.shutemov@xxxxxxxxxxxxxxx> Cc: Navid Emamdoost <navid.emamdoost@xxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/gup_benchmark.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) --- a/mm/gup_benchmark.c~mm-gup-fix-memory-leak-in-__gup_benchmark_ioctl-fix +++ a/mm/gup_benchmark.c @@ -26,6 +26,7 @@ static int __gup_benchmark_ioctl(unsigne unsigned long i, nr_pages, addr, next; int nr; struct page **pages; + int ret = 0; if (gup->size > ULONG_MAX) return -EINVAL; @@ -64,7 +65,8 @@ static int __gup_benchmark_ioctl(unsigne break; default: kvfree(pages); - return -1; + ret = -EINVAL; + goto out; } if (nr <= 0) @@ -86,7 +88,8 @@ static int __gup_benchmark_ioctl(unsigne gup->put_delta_usec = ktime_us_delta(end_time, start_time); kvfree(pages); - return 0; +out: + return ret; } static long gup_benchmark_ioctl(struct file *filep, unsigned int cmd, _ Patches currently in -mm which might be from akpm@xxxxxxxxxxxxxxxxxxxx are mm-add-apply_to_existing_pages-helper-fix.patch mm-add-apply_to_existing_pages-helper-fix-fix.patch mm-add-apply_to_existing_pages-helper-fix-fix-fix.patch kasan-use-apply_to_existing_pages-for-releasing-vmalloc-shadow-fix.patch lib-kconfigdebug-fix-some-messed-up-configurations-checkpatch-fixes.patch mm-gup-fix-memory-leak-in-__gup_benchmark_ioctl-fix.patch mm.patch mm-oom-avoid-printk-iteration-under-rcu-fix.patch drivers-block-null_blk_mainc-fix-layout.patch drivers-block-null_blk_mainc-fix-uninitialized-var-warnings.patch drivers-tty-serial-sh-scic-suppress-warning.patch kernel-forkc-export-kernel_thread-to-modules.patch