Commit 78d2d32
mm/mremap: fix regression in vrm->new_addr check
Commit 3215eac ("mm/mremap: refactor initial parameter sanity
checks") moved the sanity check for vrm->new_addr from mremap_to() to
check_mremap_params().
However, this caused a regression as vrm->new_addr is now checked even
when MREMAP_FIXED and MREMAP_DONTUNMAP flags are not specified. In this
case, vrm->new_addr can be garbage and create unexpected failures.
Fix this by moving the new_addr check after the vrm_implies_new_addr()
guard. This ensures that the new_addr is only checked when the user has
specified one explicitly.
Link: https://lkml.kernel.org/r/[email protected]
Fixes: 3215eac ("mm/mremap: refactor initial parameter sanity checks")
Signed-off-by: Carlos Llamas <[email protected]>
Reviewed-by: Liam R. Howlett <[email protected]>
Reviewed-by: Vlastimil Babka <[email protected]>
Reviewed-by: Lorenzo Stoakes <[email protected]>
Cc: Carlos Llamas <[email protected]>
Cc: Jann Horn <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>1 parent 7989fdc commit 78d2d32
1 file changed
+6
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1774 | 1774 | | |
1775 | 1775 | | |
1776 | 1776 | | |
1777 | | - | |
1778 | | - | |
1779 | | - | |
| 1777 | + | |
| 1778 | + | |
1780 | 1779 | | |
1781 | 1780 | | |
1782 | 1781 | | |
1783 | 1782 | | |
1784 | 1783 | | |
1785 | 1784 | | |
| 1785 | + | |
| 1786 | + | |
| 1787 | + | |
| 1788 | + | |
1786 | 1789 | | |
1787 | 1790 | | |
1788 | 1791 | | |
| |||
0 commit comments