Skip to content

Commit

Permalink
mm/madvise: fix memory leak from process_madvise
Browse files Browse the repository at this point in the history
The early return in process_madvise() will produce a memory leak.

Fix it.

Fixes: ecb8ac8 ("mm/madvise: introduce process_madvise() syscall: an external memory hinting API")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Minchan Kim <minchan@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Link: https://lkml.kernel.org/r/20201116155132.GA3805951@google.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Eric Dumazet authored and torvalds committed Nov 22, 2020
1 parent a349e4c commit 450677d
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions mm/madvise.c
Original file line number Diff line number Diff line change
Expand Up @@ -1231,8 +1231,6 @@ SYSCALL_DEFINE5(process_madvise, int, pidfd, const struct iovec __user *, vec,
ret = total_len - iov_iter_count(&iter);

mmput(mm);
return ret;

release_task:
put_task_struct(task);
put_pid:
Expand Down

0 comments on commit 450677d

Please sign in to comment.