Commit 71ee71d
cxl/region: Fix decoder allocation crash
When an intermediate port's decoders have been exhausted by existing
regions, and creating a new region with the port in question in it's
hierarchical path is attempted, cxl_port_attach_region() fails to find a
port decoder (as would be expected), and drops into the failure / cleanup
path.
However, during cleanup of the region reference, a sanity check attempts
to dereference the decoder, which in the above case didn't exist. This
causes a NULL pointer dereference BUG.
To fix this, refactor the decoder allocation and de-allocation into
helper routines, and in this 'free' routine, check that the decoder,
@cxld, is valid before attempting any operations on it.
Cc: <[email protected]>
Suggested-by: Dan Williams <[email protected]>
Signed-off-by: Vishal Verma <[email protected]>
Reviewed-by: Dave Jiang <[email protected]>
Fixes: 384e624 ("cxl/region: Attach endpoint decoders")
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Dan Williams <[email protected]>1 parent 24f0692 commit 71ee71d
1 file changed
+41
-26
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
687 | 687 | | |
688 | 688 | | |
689 | 689 | | |
690 | | - | |
| 690 | + | |
691 | 691 | | |
692 | | - | |
693 | 692 | | |
694 | 693 | | |
695 | 694 | | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
696 | 698 | | |
697 | 699 | | |
698 | 700 | | |
699 | 701 | | |
700 | 702 | | |
| 703 | + | |
701 | 704 | | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
702 | 711 | | |
703 | 712 | | |
704 | 713 | | |
| |||
729 | 738 | | |
730 | 739 | | |
731 | 740 | | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
732 | 768 | | |
733 | 769 | | |
734 | 770 | | |
| |||
795 | 831 | | |
796 | 832 | | |
797 | 833 | | |
798 | | - | |
799 | | - | |
800 | | - | |
801 | | - | |
802 | | - | |
803 | | - | |
804 | 834 | | |
805 | 835 | | |
806 | 836 | | |
| |||
811 | 841 | | |
812 | 842 | | |
813 | 843 | | |
814 | | - | |
815 | | - | |
816 | | - | |
817 | | - | |
818 | | - | |
819 | | - | |
820 | | - | |
821 | | - | |
822 | | - | |
823 | | - | |
824 | | - | |
825 | | - | |
826 | | - | |
827 | | - | |
828 | | - | |
| 844 | + | |
| 845 | + | |
829 | 846 | | |
830 | | - | |
831 | | - | |
832 | | - | |
833 | 847 | | |
| 848 | + | |
834 | 849 | | |
835 | 850 | | |
836 | 851 | | |
| |||
0 commit comments