Commit 10be332
x86/mce/amd: Publish the bank pointer only after setup has succeeded
commit 6e5cf31 upstream.
threshold_create_bank() creates a bank descriptor per MCA error
thresholding counter which can be controlled over sysfs. It publishes
the pointer to that bank in a per-CPU variable and then goes on to
create additional thresholding blocks if the bank has such.
However, that creation of additional blocks in
allocate_threshold_blocks() can fail, leading to a use-after-free
through the per-CPU pointer.
Therefore, publish that pointer only after all blocks have been setup
successfully.
Fixes: 019f34f ("x86, MCE, AMD: Move shared bank to node descriptor")
Reported-by: Saar Amar <Saar.Amar@microsoft.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: <stable@vger.kernel.org>
Link: http://lkml.kernel.org/r/20200128140846.phctkvx5btiexvbx@kili.mountain
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>1 parent 3404ad4 commit 10be332
1 file changed
Lines changed: 16 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
879 | 879 | | |
880 | 880 | | |
881 | 881 | | |
882 | | - | |
883 | | - | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
884 | 885 | | |
885 | 886 | | |
886 | 887 | | |
| |||
924 | 925 | | |
925 | 926 | | |
926 | 927 | | |
927 | | - | |
928 | | - | |
929 | | - | |
930 | | - | |
931 | | - | |
932 | | - | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
933 | 932 | | |
934 | | - | |
935 | | - | |
936 | | - | |
| 933 | + | |
937 | 934 | | |
938 | 935 | | |
939 | 936 | | |
940 | 937 | | |
941 | 938 | | |
942 | 939 | | |
943 | 940 | | |
944 | | - | |
| 941 | + | |
945 | 942 | | |
946 | 943 | | |
947 | 944 | | |
| |||
1026 | 1023 | | |
1027 | 1024 | | |
1028 | 1025 | | |
1029 | | - | |
1030 | | - | |
1031 | 1026 | | |
1032 | 1027 | | |
1033 | 1028 | | |
| |||
1038 | 1033 | | |
1039 | 1034 | | |
1040 | 1035 | | |
1041 | | - | |
1042 | | - | |
1043 | | - | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
1044 | 1043 | | |
1045 | 1044 | | |
1046 | 1045 | | |
| |||
0 commit comments