Merge tag 'for-linus-6.4-rc4-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip

Pull xen fixes from Juergen Gross:

- a double free fix in the Xen pvcalls backend driver

- a fix for a regression causing the MSI related sysfs entries to not
being created in Xen PV guests

- a fix in the Xen blkfront driver for handling insane input data
better

* tag 'for-linus-6.4-rc4-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip:
x86/pci/xen: populate MSI sysfs entries
xen/pvcalls-back: fix double frees with pvcalls_new_active_socket()
xen/blkfront: Only check REQ_FUA for writes

+21 -12
+5 -3
arch/x86/pci/xen.c
··· 198 i++; 199 } 200 kfree(v); 201 - return 0; 202 203 error: 204 if (ret == -ENOSYS) ··· 254 dev_dbg(&dev->dev, 255 "xen: msi --> pirq=%d --> irq=%d\n", pirq, irq); 256 } 257 - return 0; 258 259 error: 260 dev_err(&dev->dev, "Failed to create MSI%s! ret=%d!\n", ··· 346 if (ret < 0) 347 goto out; 348 } 349 - ret = 0; 350 out: 351 return ret; 352 } ··· 394 xen_destroy_irq(msidesc->irq + i); 395 msidesc->irq = 0; 396 } 397 } 398 399 static void xen_pv_teardown_msi_irqs(struct pci_dev *dev)
··· 198 i++; 199 } 200 kfree(v); 201 + return msi_device_populate_sysfs(&dev->dev); 202 203 error: 204 if (ret == -ENOSYS) ··· 254 dev_dbg(&dev->dev, 255 "xen: msi --> pirq=%d --> irq=%d\n", pirq, irq); 256 } 257 + return msi_device_populate_sysfs(&dev->dev); 258 259 error: 260 dev_err(&dev->dev, "Failed to create MSI%s! ret=%d!\n", ··· 346 if (ret < 0) 347 goto out; 348 } 349 + ret = msi_device_populate_sysfs(&dev->dev); 350 out: 351 return ret; 352 } ··· 394 xen_destroy_irq(msidesc->irq + i); 395 msidesc->irq = 0; 396 } 397 + 398 + msi_device_destroy_sysfs(&dev->dev); 399 } 400 401 static void xen_pv_teardown_msi_irqs(struct pci_dev *dev)
+2 -1
drivers/block/xen-blkfront.c
··· 780 ring_req->u.rw.handle = info->handle; 781 ring_req->operation = rq_data_dir(req) ? 782 BLKIF_OP_WRITE : BLKIF_OP_READ; 783 - if (req_op(req) == REQ_OP_FLUSH || req->cmd_flags & REQ_FUA) { 784 /* 785 * Ideally we can do an unordered flush-to-disk. 786 * In case the backend onlysupports barriers, use that.
··· 780 ring_req->u.rw.handle = info->handle; 781 ring_req->operation = rq_data_dir(req) ? 782 BLKIF_OP_WRITE : BLKIF_OP_READ; 783 + if (req_op(req) == REQ_OP_FLUSH || 784 + (req_op(req) == REQ_OP_WRITE && (req->cmd_flags & REQ_FUA))) { 785 /* 786 * Ideally we can do an unordered flush-to-disk. 787 * In case the backend onlysupports barriers, use that.
+4 -5
drivers/xen/pvcalls-back.c
··· 325 void *page; 326 327 map = kzalloc(sizeof(*map), GFP_KERNEL); 328 - if (map == NULL) 329 return NULL; 330 331 map->fedata = fedata; 332 map->sock = sock; ··· 420 req->u.connect.ref, 421 req->u.connect.evtchn, 422 sock); 423 - if (!map) { 424 ret = -EFAULT; 425 - sock_release(sock); 426 - } 427 428 out: 429 rsp = RING_GET_RESPONSE(&fedata->ring, fedata->ring.rsp_prod_pvt++); ··· 561 sock); 562 if (!map) { 563 ret = -EFAULT; 564 - sock_release(sock); 565 goto out_error; 566 } 567
··· 325 void *page; 326 327 map = kzalloc(sizeof(*map), GFP_KERNEL); 328 + if (map == NULL) { 329 + sock_release(sock); 330 return NULL; 331 + } 332 333 map->fedata = fedata; 334 map->sock = sock; ··· 418 req->u.connect.ref, 419 req->u.connect.evtchn, 420 sock); 421 + if (!map) 422 ret = -EFAULT; 423 424 out: 425 rsp = RING_GET_RESPONSE(&fedata->ring, fedata->ring.rsp_prod_pvt++); ··· 561 sock); 562 if (!map) { 563 ret = -EFAULT; 564 goto out_error; 565 } 566
+8 -1
include/linux/msi.h
··· 383 void arch_teardown_msi_irq(unsigned int irq); 384 int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type); 385 void arch_teardown_msi_irqs(struct pci_dev *dev); 386 #ifdef CONFIG_SYSFS 387 int msi_device_populate_sysfs(struct device *dev); 388 void msi_device_destroy_sysfs(struct device *dev); ··· 397 static inline int msi_device_populate_sysfs(struct device *dev) { return 0; } 398 static inline void msi_device_destroy_sysfs(struct device *dev) { } 399 #endif /* !CONFIG_SYSFS */ 400 - #endif /* CONFIG_PCI_MSI_ARCH_FALLBACKS */ 401 402 /* 403 * The restore hook is still available even for fully irq domain based
··· 383 void arch_teardown_msi_irq(unsigned int irq); 384 int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type); 385 void arch_teardown_msi_irqs(struct pci_dev *dev); 386 + #endif /* CONFIG_PCI_MSI_ARCH_FALLBACKS */ 387 + 388 + /* 389 + * Xen uses non-default msi_domain_ops and hence needs a way to populate sysfs 390 + * entries of MSI IRQs. 391 + */ 392 + #if defined(CONFIG_PCI_XEN) || defined(CONFIG_PCI_MSI_ARCH_FALLBACKS) 393 #ifdef CONFIG_SYSFS 394 int msi_device_populate_sysfs(struct device *dev); 395 void msi_device_destroy_sysfs(struct device *dev); ··· 390 static inline int msi_device_populate_sysfs(struct device *dev) { return 0; } 391 static inline void msi_device_destroy_sysfs(struct device *dev) { } 392 #endif /* !CONFIG_SYSFS */ 393 + #endif /* CONFIG_PCI_XEN || CONFIG_PCI_MSI_ARCH_FALLBACKS */ 394 395 /* 396 * The restore hook is still available even for fully irq domain based
+2 -2
kernel/irq/msi.c
··· 542 return ret; 543 } 544 545 - #ifdef CONFIG_PCI_MSI_ARCH_FALLBACKS 546 /** 547 * msi_device_populate_sysfs - Populate msi_irqs sysfs entries for a device 548 * @dev: The device (PCI, platform etc) which will get sysfs entries ··· 574 msi_for_each_desc(desc, dev, MSI_DESC_ALL) 575 msi_sysfs_remove_desc(dev, desc); 576 } 577 - #endif /* CONFIG_PCI_MSI_ARCH_FALLBACK */ 578 #else /* CONFIG_SYSFS */ 579 static inline int msi_sysfs_create_group(struct device *dev) { return 0; } 580 static inline int msi_sysfs_populate_desc(struct device *dev, struct msi_desc *desc) { return 0; }
··· 542 return ret; 543 } 544 545 + #if defined(CONFIG_PCI_MSI_ARCH_FALLBACKS) || defined(CONFIG_PCI_XEN) 546 /** 547 * msi_device_populate_sysfs - Populate msi_irqs sysfs entries for a device 548 * @dev: The device (PCI, platform etc) which will get sysfs entries ··· 574 msi_for_each_desc(desc, dev, MSI_DESC_ALL) 575 msi_sysfs_remove_desc(dev, desc); 576 } 577 + #endif /* CONFIG_PCI_MSI_ARCH_FALLBACK || CONFIG_PCI_XEN */ 578 #else /* CONFIG_SYSFS */ 579 static inline int msi_sysfs_create_group(struct device *dev) { return 0; } 580 static inline int msi_sysfs_populate_desc(struct device *dev, struct msi_desc *desc) { return 0; }