History

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

Linus Torvalds committed 3 years ago

Commit 4e893b52 parents 957f3f8 335b4225 files · +21 −12Browse files

Unified · Split

5 files
  1. arch/x86/pci/xen.c +5 −3
  2. drivers/block/xen-blkfront.c +2 −1
  3. drivers/xen/pvcalls-back.c +4 −5
  4. include/linux/msi.h +8 −1
  5. kernel/irq/msi.c +2 −2
arch/x86/pci/xen.c+5−3
@@ -198,7 +198,7 @@ static int xen_setup_msi_irqs(struct pci_dev *dev, int nvec, int type) · 197 unmodified lines
198198 i++;
199199 }
200200 kfree(v);
201− return 0;
201+ return msi_device_populate_sysfs(&dev->dev);
202202
203203 error:
204204 if (ret == -ENOSYS)
@@ -254,7 +254,7 @@ static int xen_hvm_setup_msi_irqs(struct pci_dev *dev, int nvec, int type) · 49 unmodified lines
254254 dev_dbg(&dev->dev,
255255 "xen: msi --> pirq=%d --> irq=%d\n", pirq, irq);
256256 }
257− return 0;
257+ return msi_device_populate_sysfs(&dev->dev);
258258
259259 error:
260260 dev_err(&dev->dev, "Failed to create MSI%s! ret=%d!\n",
@@ -346,7 +346,7 @@ static int xen_initdom_setup_msi_irqs(struct pci_dev *dev, int nvec, int type) · 85 unmodified lines
346346 if (ret < 0)
347347 goto out;
348348 }
349− ret = 0;
349+ ret = msi_device_populate_sysfs(&dev->dev);
350350 out:
351351 return ret;
352352 }
@@ -394,6 +394,8 @@ static void xen_teardown_msi_irqs(struct pci_dev *dev) · 41 unmodified lines
394394 xen_destroy_irq(msidesc->irq + i);
395395 msidesc->irq = 0;
396396 }
397+
398+ msi_device_destroy_sysfs(&dev->dev);
397399 }
398400
399401 static void xen_pv_teardown_msi_irqs(struct pci_dev *dev)
drivers/block/xen-blkfront.c+2−1
@@ -780,7 +780,8 @@ static int blkif_queue_rw_req(struct request *req, struct blkfront_ring_info *ri · 779 unmodified lines
780780 ring_req->u.rw.handle = info->handle;
781781 ring_req->operation = rq_data_dir(req) ?
782782 BLKIF_OP_WRITE : BLKIF_OP_READ;
783− if (req_op(req) == REQ_OP_FLUSH || req->cmd_flags & REQ_FUA) {
783+ if (req_op(req) == REQ_OP_FLUSH ||
784+ (req_op(req) == REQ_OP_WRITE && (req->cmd_flags & REQ_FUA))) {
784785 /*
785786 * Ideally we can do an unordered flush-to-disk.
786787 * In case the backend onlysupports barriers, use that.
drivers/xen/pvcalls-back.c+4−5
@@ -325,8 +325,10 @@ static struct sock_mapping *pvcalls_new_active_socket( · 324 unmodified lines
325325 void *page;
326326
327327 map = kzalloc(sizeof(*map), GFP_KERNEL);
328− if (map == NULL)
328+ if (map == NULL) {
329+ sock_release(sock);
329330 return NULL;
331+ }
330332
331333 map->fedata = fedata;
332334 map->sock = sock;
@@ -418,10 +420,8 @@ static int pvcalls_back_connect(struct xenbus_device *dev, · 85 unmodified lines
418420 req->u.connect.ref,
419421 req->u.connect.evtchn,
420422 sock);
421− if (!map) {
423+ if (!map)
422424 ret = -EFAULT;
423− sock_release(sock);
424− }
425425
426426 out:
427427 rsp = RING_GET_RESPONSE(&fedata->ring, fedata->ring.rsp_prod_pvt++);
@@ -561,7 +561,6 @@ static void __pvcalls_back_accept(struct work_struct *work) · 133 unmodified lines
561561 sock);
562562 if (!map) {
563563 ret = -EFAULT;
564− sock_release(sock);
565564 goto out_error;
566565 }
567566
include/linux/msi.h+8−1
@@ -383,6 +383,13 @@ int arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc); · 382 unmodified lines
383383 void arch_teardown_msi_irq(unsigned int irq);
384384 int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type);
385385 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)
386393 #ifdef CONFIG_SYSFS
387394 int msi_device_populate_sysfs(struct device *dev);
388395 void msi_device_destroy_sysfs(struct device *dev);
@@ -390,7 +397,7 @@ void msi_device_destroy_sysfs(struct device *dev); · 1 unmodified line
390397 static inline int msi_device_populate_sysfs(struct device *dev) { return 0; }
391398 static inline void msi_device_destroy_sysfs(struct device *dev) { }
392399 #endif /* !CONFIG_SYSFS */
393−#endif /* CONFIG_PCI_MSI_ARCH_FALLBACKS */
400+#endif /* CONFIG_PCI_XEN || CONFIG_PCI_MSI_ARCH_FALLBACKS */
394401
395402 /*
396403 * The restore hook is still available even for fully irq domain based
kernel/irq/msi.c+2−2
@@ -542,7 +542,7 @@ fail: · 541 unmodified lines
542542 return ret;
543543 }
544544
545−#ifdef CONFIG_PCI_MSI_ARCH_FALLBACKS
545+#if defined(CONFIG_PCI_MSI_ARCH_FALLBACKS) || defined(CONFIG_PCI_XEN)
546546 /**
547547 * msi_device_populate_sysfs - Populate msi_irqs sysfs entries for a device
548548 * @dev: The device (PCI, platform etc) which will get sysfs entries
@@ -574,7 +574,7 @@ void msi_device_destroy_sysfs(struct device *dev) · 25 unmodified lines
574574 msi_for_each_desc(desc, dev, MSI_DESC_ALL)
575575 msi_sysfs_remove_desc(dev, desc);
576576 }
577−#endif /* CONFIG_PCI_MSI_ARCH_FALLBACK */
577+#endif /* CONFIG_PCI_MSI_ARCH_FALLBACK || CONFIG_PCI_XEN */
578578 #else /* CONFIG_SYSFS */
579579 static inline int msi_sysfs_create_group(struct device *dev) { return 0; }
580580 static inline int msi_sysfs_populate_desc(struct device *dev, struct msi_desc *desc) { return 0; }