History

Merge branch 'efi-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull EFI fixes from Ingo Molnar: "Misc EFI fixes all across the map: CPER error report fixes, fixes to TPM event log parsing, fix for a kexec hang, a Sparse fix and other fixes" * 'efi-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: efi/tpm: Fix sanity check of unsigned tbl_size being less than zero efi/x86: Do not clean dummy variable in kexec path efi: Make unexported efi_rci2_sysfs_init() static efi/tpm: Only set 'efi_tpm_final_log_size' after successful event log parsing efi/tpm: Don't traverse an event log with no events efi/tpm: Don't access event->count when it isn't mapped efivar/ssdt: Don't iterate over EFI vars if no SSDT override was specified efi/cper: Fix endianness of PCIe class code

Linus Torvalds committed 7 years ago

Commit 9b4e40c2 parents fcb45a2 be59d576 files · +36 −16Browse files

Showing the changes to include/linux (1 of 6 files). Show all

Unified · Split

include/linux/tpm_eventlog.h+12−4
@@ -152,7 +152,7 @@ struct tcg_algorithm_info { · 151 unmodified lines
152152 * total. Once we've done this we know the offset of the data length field,
153153 * and can calculate the total size of the event.
154154 *
155− * Return: size of the event on success, <0 on failure
155+ * Return: size of the event on success, 0 on failure
156156 */
157157
158158 static inline int __calc_tpm2_event_size(struct tcg_pcr_event2_head *event,
@@ -170,6 +170,7 @@ static inline int __calc_tpm2_event_size(struct tcg_pcr_event2_head *event, · 11 unmodified lines
170170 u16 halg;
171171 int i;
172172 int j;
173+ u32 count, event_type;
173174
174175 marker = event;
175176 marker_start = marker;
@@ -190,16 +191,22 @@ static inline int __calc_tpm2_event_size(struct tcg_pcr_event2_head *event, · 14 unmodified lines
190191 }
191192
192193 event = (struct tcg_pcr_event2_head *)mapping;
194+ /*
195+ * The loop below will unmap these fields if the log is larger than
196+ * one page, so save them here for reference:
197+ */
198+ count = READ_ONCE(event->count);
199+ event_type = READ_ONCE(event->event_type);
193200
194201 efispecid = (struct tcg_efi_specid_event_head *)event_header->event;
195202
196203 /* Check if event is malformed. */
197− if (event->count > efispecid->num_algs) {
204+ if (count > efispecid->num_algs) {
198205 size = 0;
199206 goto out;
200207 }
201208
202− for (i = 0; i < event->count; i++) {
209+ for (i = 0; i < count; i++) {
203210 halg_size = sizeof(event->digests[i].alg_id);
204211
205212 /* Map the digest's algorithm identifier */
@@ -256,8 +263,9 @@ static inline int __calc_tpm2_event_size(struct tcg_pcr_event2_head *event, · 50 unmodified lines
256263 + event_field->event_size;
257264 size = marker - marker_start;
258265
259− if ((event->event_type == 0) && (event_field->event_size == 0))
266+ if (event_type == 0 && event_field->event_size == 0)
260267 size = 0;
268+
261269 out:
262270 if (do_mapping)
263271 TPM_MEMUNMAP(mapping, mapping_size);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t