mm/swap: fix swapon failure
Hi:
Quoted 11 lines · Alex Shi
One of my VM guest has a swapon issue:
root #swapon -v -f /swap1
swapon /swap1
swapon: /swap1: found swap signature: version 1, page-size 4, same byte order
swapon: /swap1: pagesize=4096, swapsize=1607467008, devsize=1607467008
swapon: /swap1: swapon failed: Invalid argumentand bisection report commit
822bca52ee7e"mm/swapfile.c: fix potential memory leak insys_swapon" cause the trouble.Go through the context I found the
exit_swap_address_space(p->type)shouldn't be used in good result path. So just move it to error path.
Many thanks for your patch. But I'am somehow confused as we only do the label free_swap_address_space stuff in error path. And the good result path can't reach here as it just goto out before free_swap_address_space label. Could you please explain it for me more detailed?
Thanks again.
Quoted 4 lines
Fixes 822bca52ee7e ("mm/swapfile.c: fix potential memory leak in
sys_swapon")Signed-off-by Alex Shi <[email protected]>Cc Andrew Morton <[email protected]>