diff options
author | Oleg Nesterov <oleg@tv-sign.ru> | 2008-07-04 12:59:28 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-04 13:40:04 -0400 |
commit | 7a36a752d006f6874049da510297eeb7f09d92a7 (patch) | |
tree | 764d02c44b95e34deb9cd3ed9d7bdc03c35ef172 | |
parent | 7ca796f492a11f9408e661c8f22cd8c4f486b8e5 (diff) |
get_user_pages(): fix possible page leak on oom
get_user_pages() must not return the error when i != 0. When pages !=
NULL we have i get_page()'ed pages.
Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
Acked-by: Nick Piggin <npiggin@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | mm/memory.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/mm/memory.c b/mm/memory.c index 350e646032f5..2302d228fe04 100644 --- a/mm/memory.c +++ b/mm/memory.c | |||
@@ -1151,7 +1151,7 @@ int get_user_pages(struct task_struct *tsk, struct mm_struct *mm, | |||
1151 | * be processed until returning to user space. | 1151 | * be processed until returning to user space. |
1152 | */ | 1152 | */ |
1153 | if (unlikely(test_tsk_thread_flag(tsk, TIF_MEMDIE))) | 1153 | if (unlikely(test_tsk_thread_flag(tsk, TIF_MEMDIE))) |
1154 | return -ENOMEM; | 1154 | return i ? i : -ENOMEM; |
1155 | 1155 | ||
1156 | if (write) | 1156 | if (write) |
1157 | foll_flags |= FOLL_WRITE; | 1157 | foll_flags |= FOLL_WRITE; |