mm-commits.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [merged] mm-fix-potential-memory-leak-in-sys_swapon.patch removed from -mm tree
@ 2020-10-14 20:59 akpm
  0 siblings, 0 replies; only message in thread
From: akpm @ 2020-10-14 20:59 UTC (permalink / raw)
  To: darrick.wong, linmiaohe, mm-commits


The patch titled
     Subject: mm/swapfile.c: fix potential memory leak in sys_swapon
has been removed from the -mm tree.  Its filename was
     mm-fix-potential-memory-leak-in-sys_swapon.patch

This patch was dropped because it was merged into mainline or a subsystem tree

------------------------------------------------------
From: Miaohe Lin <linmiaohe@huawei.com>
Subject: mm/swapfile.c: fix potential memory leak in sys_swapon

If we failed to drain inode, we would forget to free the swap address
space allocated by init_swap_address_space() above.

Link: https://lkml.kernel.org/r/20200930101803.53884-1-linmiaohe@huawei.com
Fixes: dc617f29dbe5 ("vfs: don't allow writes to swap files")
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 mm/swapfile.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--- a/mm/swapfile.c~mm-fix-potential-memory-leak-in-sys_swapon
+++ a/mm/swapfile.c
@@ -3342,7 +3342,7 @@ SYSCALL_DEFINE2(swapon, const char __use
 	error = inode_drain_writes(inode);
 	if (error) {
 		inode->i_flags &= ~S_SWAPFILE;
-		goto bad_swap_unlock_inode;
+		goto free_swap_address_space;
 	}
 
 	mutex_lock(&swapon_mutex);
@@ -3367,6 +3367,8 @@ SYSCALL_DEFINE2(swapon, const char __use
 
 	error = 0;
 	goto out;
+free_swap_address_space:
+	exit_swap_address_space(p->type);
 bad_swap_unlock_inode:
 	inode_unlock(inode);
 bad_swap:
_

Patches currently in -mm which might be from linmiaohe@huawei.com are

mm-vmstat-use-helper-macro-abs.patch
mm-fix-some-broken-comments.patch
mm-use-helper-function-put_write_access.patch
percpu_counter-use-helper-macro-abs.patch
mm-migrate-avoid-possible-unnecessary-process-right-check-in-kernel_move_pages.patch


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-10-14 20:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-14 20:59 [merged] mm-fix-potential-memory-leak-in-sys_swapon.patch removed from -mm tree akpm

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).