Repository navigation
Commit 26f98b2
iwlwifi: pcie: make cfg vs. trans_cfg more robust
[ Upstream commit 48a5494 ]
If we (for example) have a trans_cfg entry in the PCI IDs table,
but then don't find a full cfg entry for it in the info table,
we fall through to the code that treats the PCI ID table entry
as a full cfg entry. This obviously causes crashes later, e.g.
when trying to build the firmware name string.
Avoid such crashes by using the low bit of the pointer as a tag
for trans_cfg entries (automatically using a macro that checks
the type when assigning) and then checking that before trying to
use the data as a full entry - if it's just a partial entry at
that point, fail.
Since we're adding some macro magic, also check that the type is
in fact either struct iwl_cfg_trans_params or struct iwl_cfg,
failing compilation ("initializer element is not constant") if
it isn't.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210330162204.6f69fe6e4128.I921d4ae20ef5276716baeeeda0b001cf25b9b968@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>1 parent 2bfc47d commit 26f98b2
1 file changed
Lines changed: 28 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
76 | 86 | | |
77 | 87 | | |
78 | 88 | | |
79 | | - | |
| 89 | + | |
80 | 90 | | |
81 | 91 | | |
82 | 92 | | |
| |||
1018 | 1028 | | |
1019 | 1029 | | |
1020 | 1030 | | |
1021 | | - | |
1022 | | - | |
| 1031 | + | |
1023 | 1032 | | |
1024 | 1033 | | |
1025 | 1034 | | |
1026 | 1035 | | |
1027 | 1036 | | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
1028 | 1041 | | |
1029 | 1042 | | |
1030 | 1043 | | |
1031 | 1044 | | |
1032 | 1045 | | |
1033 | 1046 | | |
1034 | | - | |
| 1047 | + | |
1035 | 1048 | | |
1036 | 1049 | | |
1037 | 1050 | | |
| |||
1133 | 1146 | | |
1134 | 1147 | | |
1135 | 1148 | | |
1136 | | - | |
1137 | | - | |
| 1149 | + | |
| 1150 | + | |
1138 | 1151 | | |
1139 | | - | |
| 1152 | + | |
| 1153 | + | |
| 1154 | + | |
| 1155 | + | |
| 1156 | + | |
| 1157 | + | |
| 1158 | + | |
| 1159 | + | |
1140 | 1160 | | |
| 1161 | + | |
1141 | 1162 | | |
1142 | 1163 | | |
1143 | 1164 | | |
| |||
0 commit comments