]> git.baikalelectronics.ru Git - kernel.git/commit
mm/swapfile.c: fix potential memory leak in sys_swapon
authorMiaohe Lin <linmiaohe@huawei.com>
Tue, 13 Oct 2020 23:52:30 +0000 (16:52 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 14 Oct 2020 01:38:30 +0000 (18:38 -0700)
commit03e852f70462bda5098a41bd89b21392a3a59612
tree6f000145cb0d31b5d1abe913ba02bc0031a45fd9
parentccb44f1fc6e9521ad0b7ea9f5bf5b879b5a7e5b0
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.

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