Commit 824135c
mmap: fix error paths with dup_anon_vma()
When the calling function fails after the dup_anon_vma(), the
duplication of the anon_vma is not being undone. Add the necessary
unlink_anon_vma() call to the error paths that are missing them.
This issue showed up during inspection of the error path in vma_merge()
for an unrelated vma iterator issue.
Users may experience increased memory usage, which may be problematic as
the failure would likely be caused by a low memory situation.
Link: https://lkml.kernel.org/r/20230929183041.2835469-3-Liam.Howlett@oracle.com
Fixes: d4af56c ("mm: start tracking VMAs with maple tree")
Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
Reviewed-by: Lorenzo Stoakes <lstoakes@gmail.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Cc: Jann Horn <jannh@google.com>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>1 parent 1419430 commit 824135c
1 file changed
Lines changed: 22 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
583 | 583 | | |
584 | 584 | | |
585 | 585 | | |
| 586 | + | |
586 | 587 | | |
587 | 588 | | |
588 | 589 | | |
589 | 590 | | |
590 | | - | |
| 591 | + | |
591 | 592 | | |
592 | 593 | | |
593 | 594 | | |
594 | 595 | | |
595 | 596 | | |
596 | 597 | | |
597 | 598 | | |
| 599 | + | |
| 600 | + | |
598 | 601 | | |
599 | 602 | | |
600 | | - | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
601 | 608 | | |
602 | 609 | | |
603 | 610 | | |
| |||
624 | 631 | | |
625 | 632 | | |
626 | 633 | | |
| 634 | + | |
627 | 635 | | |
628 | 636 | | |
629 | 637 | | |
| |||
633 | 641 | | |
634 | 642 | | |
635 | 643 | | |
636 | | - | |
| 644 | + | |
637 | 645 | | |
638 | 646 | | |
639 | 647 | | |
| |||
661 | 669 | | |
662 | 670 | | |
663 | 671 | | |
| 672 | + | |
| 673 | + | |
664 | 674 | | |
665 | 675 | | |
666 | 676 | | |
| |||
860 | 870 | | |
861 | 871 | | |
862 | 872 | | |
| 873 | + | |
863 | 874 | | |
864 | 875 | | |
865 | 876 | | |
| |||
927 | 938 | | |
928 | 939 | | |
929 | 940 | | |
930 | | - | |
| 941 | + | |
931 | 942 | | |
932 | 943 | | |
933 | 944 | | |
934 | 945 | | |
935 | 946 | | |
936 | | - | |
| 947 | + | |
937 | 948 | | |
938 | 949 | | |
939 | 950 | | |
940 | 951 | | |
941 | | - | |
| 952 | + | |
942 | 953 | | |
943 | 954 | | |
944 | 955 | | |
| |||
954 | 965 | | |
955 | 966 | | |
956 | 967 | | |
957 | | - | |
| 968 | + | |
958 | 969 | | |
959 | 970 | | |
960 | 971 | | |
| |||
968 | 979 | | |
969 | 980 | | |
970 | 981 | | |
971 | | - | |
| 982 | + | |
972 | 983 | | |
973 | 984 | | |
974 | 985 | | |
| |||
1018 | 1029 | | |
1019 | 1030 | | |
1020 | 1031 | | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
1021 | 1035 | | |
1022 | 1036 | | |
1023 | 1037 | | |
| |||
0 commit comments