summaryrefslogtreecommitdiffstats
path: root/mm/madvise.c
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2020-11-21 22:16:58 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2020-11-22 10:48:22 -0800
commit450677dcb0cce5cb751538360b7196c28b733f3e (patch)
tree327fe48fc8f1a993669f3b3d86ac0cda59063e85 /mm/madvise.c
parenta349e4c659609fd20e4beea89e5c4a4038e33a95 (diff)
downloadlinux-450677dcb0cce5cb751538360b7196c28b733f3e.tar.gz
linux-450677dcb0cce5cb751538360b7196c28b733f3e.tar.bz2
linux-450677dcb0cce5cb751538360b7196c28b733f3e.zip
mm/madvise: fix memory leak from process_madvise
The early return in process_madvise() will produce a memory leak. Fix it. Fixes: ecb8ac8b1f14 ("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>
Diffstat (limited to 'mm/madvise.c')
-rw-r--r--mm/madvise.c2
1 files changed, 0 insertions, 2 deletions
diff --git a/mm/madvise.c b/mm/madvise.c
index 416a56b8e757..7e773f949ef9 100644
--- a/mm/madvise.c
+++ b/mm/madvise.c
@@ -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: