File tree 1 file changed +22
-0
lines changed
1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -143,6 +143,23 @@ static const struct attribute_group boot_attr_group = {
143
143
144
144
static struct kobject * fpdt_kobj ;
145
145
146
+ #if defined CONFIG_X86 && defined CONFIG_PHYS_ADDR_T_64BIT
147
+ #include <linux/processor.h>
148
+ static bool fpdt_address_valid (u64 address )
149
+ {
150
+ /*
151
+ * On some systems the table contains invalid addresses
152
+ * with unsuppored high address bits set, check for this.
153
+ */
154
+ return !(address >> boot_cpu_data .x86_phys_bits );
155
+ }
156
+ #else
157
+ static bool fpdt_address_valid (u64 address )
158
+ {
159
+ return true;
160
+ }
161
+ #endif
162
+
146
163
static int fpdt_process_subtable (u64 address , u32 subtable_type )
147
164
{
148
165
struct fpdt_subtable_header * subtable_header ;
@@ -151,6 +168,11 @@ static int fpdt_process_subtable(u64 address, u32 subtable_type)
151
168
u32 length , offset ;
152
169
int result ;
153
170
171
+ if (!fpdt_address_valid (address )) {
172
+ pr_info (FW_BUG "invalid physical address: 0x%llx!\n" , address );
173
+ return - EINVAL ;
174
+ }
175
+
154
176
subtable_header = acpi_os_map_memory (address , sizeof (* subtable_header ));
155
177
if (!subtable_header )
156
178
return - ENOMEM ;
You can’t perform that action at this time.
0 commit comments