Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

x86, mrst: use a temporary variable for SFI irq

SFI tables reside in RAM and should not be modified once they are
written. Current code went to set pentry->irq to zero which causes
subsequent reads to fail with invalid SFI table checksum. This will
break kexec as the second kernel fails to validate SFI tables.

To fix this we use temporary variable for irq number.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Reviewed-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: stable@kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Mika Westerberg and committed by
Linus Torvalds
153b19a3 37cf9516

+12 -10
+12 -10
arch/x86/platform/mrst/mrst.c
··· 678 678 pentry = (struct sfi_device_table_entry *)sb->pentry; 679 679 680 680 for (i = 0; i < num; i++, pentry++) { 681 - if (pentry->irq != (u8)0xff) { /* native RTE case */ 681 + int irq = pentry->irq; 682 + 683 + if (irq != (u8)0xff) { /* native RTE case */ 682 684 /* these SPI2 devices are not exposed to system as PCI 683 685 * devices, but they have separate RTE entry in IOAPIC 684 686 * so we have to enable them one by one here 685 687 */ 686 - ioapic = mp_find_ioapic(pentry->irq); 688 + ioapic = mp_find_ioapic(irq); 687 689 irq_attr.ioapic = ioapic; 688 - irq_attr.ioapic_pin = pentry->irq; 690 + irq_attr.ioapic_pin = irq; 689 691 irq_attr.trigger = 1; 690 692 irq_attr.polarity = 1; 691 - io_apic_set_pci_routing(NULL, pentry->irq, &irq_attr); 693 + io_apic_set_pci_routing(NULL, irq, &irq_attr); 692 694 } else 693 - pentry->irq = 0; /* No irq */ 695 + irq = 0; /* No irq */ 694 696 695 697 switch (pentry->type) { 696 698 case SFI_DEV_TYPE_IPC: 697 699 /* ID as IRQ is a hack that will go away */ 698 - pdev = platform_device_alloc(pentry->name, pentry->irq); 700 + pdev = platform_device_alloc(pentry->name, irq); 699 701 if (pdev == NULL) { 700 702 pr_err("out of memory for SFI platform device '%s'.\n", 701 703 pentry->name); 702 704 continue; 703 705 } 704 - install_irq_resource(pdev, pentry->irq); 706 + install_irq_resource(pdev, irq); 705 707 pr_debug("info[%2d]: IPC bus, name = %16.16s, " 706 - "irq = 0x%2x\n", i, pentry->name, pentry->irq); 708 + "irq = 0x%2x\n", i, pentry->name, irq); 707 709 sfi_handle_ipc_dev(pdev); 708 710 break; 709 711 case SFI_DEV_TYPE_SPI: 710 712 memset(&spi_info, 0, sizeof(spi_info)); 711 713 strncpy(spi_info.modalias, pentry->name, SFI_NAME_LEN); 712 - spi_info.irq = pentry->irq; 714 + spi_info.irq = irq; 713 715 spi_info.bus_num = pentry->host_num; 714 716 spi_info.chip_select = pentry->addr; 715 717 spi_info.max_speed_hz = pentry->max_freq; ··· 728 726 memset(&i2c_info, 0, sizeof(i2c_info)); 729 727 bus = pentry->host_num; 730 728 strncpy(i2c_info.type, pentry->name, SFI_NAME_LEN); 731 - i2c_info.irq = pentry->irq; 729 + i2c_info.irq = irq; 732 730 i2c_info.addr = pentry->addr; 733 731 pr_debug("info[%2d]: I2C bus = %d, name = %16.16s, " 734 732 "irq = 0x%2x, addr = 0x%x\n", i, bus,