[PATCH RFC 13/25] PCI/LUO: Check the device function numbers in restoration

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Jason Miu <jasonmiu@xxxxxxxxxx>

After liveupdate reboot, the device BDF shouldn't be changed from the
previous kernel. If this happens, the saved LUO device state cannot be
used, and panic the kernel.

Signed-off-by: Chris Li <chrisl@xxxxxxxxxx>
---
 drivers/pci/liveupdate.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/pci/liveupdate.c b/drivers/pci/liveupdate.c
index 6b1c14d70fd16b0919ca22faae788069f3743708..ec2d7917441ceb4e3d7cd8becae41ca215cba7c3 100644
--- a/drivers/pci/liveupdate.c
+++ b/drivers/pci/liveupdate.c
@@ -393,6 +393,15 @@ static void pci_dev_do_restore(struct pci_dev *dev, struct pci_dev_ser *s)
 	pci_info(dev, "liveupdate restore [%s] driver: %s data: [%llx] num_vfs: %d\n",
 		 s->requested ? "requested" : "depended",
 		 s->driver_name, s->driver_data, s->num_vfs);
+
+	/*
+	 * The devfn got changed since reboot. We cannot restore device
+	 * info preserved by liveupdate
+	 */
+	if (s->devfn != dev->devfn)
+		panic("%s: Device and function numbers are changed from 0x%40x to 0x%40x\n",
+		      __func__, s->devfn, dev->devfn);
+
 	list_move_tail(&dev->dev.lu.lu_next, &probe_devices);
 }
 

-- 
2.50.1.487.gc89ff58d15-goog





[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]
  Powered by Linux