unlocked access to struct irq_data->chip_data in pci_hyperv

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

 



Hello,

there are several crash reports due to struct irq_data->chip_data being NULL.

I was under the impression all the "recent changes" to pci-hyperv.c
would fix them. But apparently this specific issue is still there.

What does serialize read and write access to struct irq_data->chip_data?
It seems hv_msi_free can run while other code paths still access at least
->chip_data.

The change below may reduce the window, but I'm not confident this would
actually resolve the concurrency issues.


Olaf

--- a/drivers/pci/controller/pci-hyperv.c
+++ b/drivers/pci/controller/pci-hyperv.c
@@ -1760,8 +1760,9 @@ static void hv_compose_msi_msg(struct irq_data *data, struct msi_msg *msg)
 		    msi_desc->nvec_used > 1;
 
 	/* Reuse the previous allocation */
-	if (data->chip_data && multi_msi) {
-		int_desc = data->chip_data;
+	virt_rmb();
+	int_desc = READ_ONCE(data->chip_data);
+	if (int_desc && multi_msi) {
 		msg->address_hi = int_desc->address >> 32;
 		msg->address_lo = int_desc->address & 0xffffffff;
 		msg->data = int_desc->data;
@@ -1778,8 +1779,9 @@ static void hv_compose_msi_msg(struct irq_data *data, struct msi_msg *msg)
 		goto return_null_message;
 
 	/* Free any previous message that might have already been composed. */
-	if (data->chip_data && !multi_msi) {
-		int_desc = data->chip_data;
+	virt_rmb();
+	int_desc = READ_ONCE(data->chip_data);
+	if (int_desc && !multi_msi) {
 		data->chip_data = NULL;
 		hv_int_desc_free(hpdev, int_desc);
 	}

Attachment: pgpwMjZHowBDh.pgp
Description: Digitale Signatur von OpenPGP


[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux