History

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

Pull xen fixes from Juergen Gross: - a minor fix for the Xen grant driver - a small series fixing a recently introduced problem in the Xen blkfront/blkback drivers with negotiation of feature usage * tag 'for-linus-6.0-rc4-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip: xen/grants: prevent integer overflow in gnttab_dma_alloc_pages() xen-blkfront: Cache feature_persistent value before advertisement xen-blkfront: Advertise feature-persistent as user requested xen-blkback: Advertise feature-persistent as user requested

Linus Torvalds committed 4 years ago

Commit 65eea2c2 parents f0c5f7e e9ea0b34 files · +22 −10Browse files

Unified · Split

4 files
  1. drivers/block/xen-blkback/common.h +3 −0
  2. drivers/block/xen-blkback/xenbus.c +4 −2
  3. drivers/block/xen-blkfront.c +12 −8
  4. drivers/xen/grant-table.c +3 −0
drivers/block/xen-blkback/common.h+3−0
@@ -226,6 +226,9 @@ struct xen_vbd { · 225 unmodified lines
226 sector_t size;226 sector_t size;
227 unsigned int flush_support:1;227 unsigned int flush_support:1;
228 unsigned int discard_secure:1;228 unsigned int discard_secure:1;
229 /* Connect-time cached feature_persistent parameter value */
230 unsigned int feature_gnt_persistent_parm:1;
231 /* Persistent grants feature negotiation result */
229 unsigned int feature_gnt_persistent:1;232 unsigned int feature_gnt_persistent:1;
230 unsigned int overflow_max_grants:1;233 unsigned int overflow_max_grants:1;
231};234};
drivers/block/xen-blkback/xenbus.c+4−2
@@ -907,7 +907,7 @@ again: · 906 unmodified lines
907 xen_blkbk_barrier(xbt, be, be->blkif->vbd.flush_support);907 xen_blkbk_barrier(xbt, be, be->blkif->vbd.flush_support);
908 908
909 err = xenbus_printf(xbt, dev->nodename, "feature-persistent", "%u",909 err = xenbus_printf(xbt, dev->nodename, "feature-persistent", "%u",
910 be->blkif->vbd.feature_gnt_persistent);910 be->blkif->vbd.feature_gnt_persistent_parm);
911 if (err) {911 if (err) {
912 xenbus_dev_fatal(dev, err, "writing %s/feature-persistent",912 xenbus_dev_fatal(dev, err, "writing %s/feature-persistent",
913 dev->nodename);913 dev->nodename);
@@ -1085,7 +1085,9 @@ static int connect_ring(struct backend_info *be) · 171 unmodified lines
1085 return -ENOSYS;1085 return -ENOSYS;
1086 }1086 }
1087 1087
1088 blkif->vbd.feature_gnt_persistent = feature_persistent &&1088 blkif->vbd.feature_gnt_persistent_parm = feature_persistent;
1089 blkif->vbd.feature_gnt_persistent =
1090 blkif->vbd.feature_gnt_persistent_parm &&
1089 xenbus_read_unsigned(dev->otherend, "feature-persistent", 0);1091 xenbus_read_unsigned(dev->otherend, "feature-persistent", 0);
1090 1092
1091 blkif->vbd.overflow_max_grants = 0;1093 blkif->vbd.overflow_max_grants = 0;
drivers/block/xen-blkfront.c+12−8
@@ -213,6 +213,9 @@ struct blkfront_info · 212 unmodified lines
213 unsigned int feature_fua:1;213 unsigned int feature_fua:1;
214 unsigned int feature_discard:1;214 unsigned int feature_discard:1;
215 unsigned int feature_secdiscard:1;215 unsigned int feature_secdiscard:1;
216 /* Connect-time cached feature_persistent parameter */
217 unsigned int feature_persistent_parm:1;
218 /* Persistent grants feature negotiation result */
216 unsigned int feature_persistent:1;219 unsigned int feature_persistent:1;
217 unsigned int bounce:1;220 unsigned int bounce:1;
218 unsigned int discard_granularity;221 unsigned int discard_granularity;
@@ -1756,6 +1759,12 @@ abort_transaction: · 1537 unmodified lines
1756 return err;1759 return err;
1757}1760}
1758 1761
1762/* Enable the persistent grants feature. */
1763static bool feature_persistent = true;
1764module_param(feature_persistent, bool, 0644);
1765MODULE_PARM_DESC(feature_persistent,
1766 "Enables the persistent grants feature");
1767
1759/* Common code used when first setting up, and when resuming. */1768/* Common code used when first setting up, and when resuming. */
1760static int talk_to_blkback(struct xenbus_device *dev,1769static int talk_to_blkback(struct xenbus_device *dev,
1761 struct blkfront_info *info)1770 struct blkfront_info *info)
@@ -1847,8 +1856,9 @@ again: · 85 unmodified lines
1847 message = "writing protocol";1856 message = "writing protocol";
1848 goto abort_transaction;1857 goto abort_transaction;
1849 }1858 }
1859 info->feature_persistent_parm = feature_persistent;
1850 err = xenbus_printf(xbt, dev->nodename, "feature-persistent", "%u",1860 err = xenbus_printf(xbt, dev->nodename, "feature-persistent", "%u",
1851 info->feature_persistent);1861 info->feature_persistent_parm);
1852 if (err)1862 if (err)
1853 dev_warn(&dev->dev,1863 dev_warn(&dev->dev,
1854 "writing persistent grants feature to xenbus");1864 "writing persistent grants feature to xenbus");
@@ -1916,12 +1926,6 @@ static int negotiate_mq(struct blkfront_info *info) · 61 unmodified lines
1916 return 0;1926 return 0;
1917}1927}
1918 1928
1919/* Enable the persistent grants feature. */
1920static bool feature_persistent = true;
1921module_param(feature_persistent, bool, 0644);
1922MODULE_PARM_DESC(feature_persistent,
1923 "Enables the persistent grants feature");
1924
1925/*1929/*
1926 * Entry point to this code when a new device is created. Allocate the basic1930 * Entry point to this code when a new device is created. Allocate the basic
1927 * structures and the ring buffer for communication with the backend, and1931 * structures and the ring buffer for communication with the backend, and
@@ -2281,7 +2285,7 @@ static void blkfront_gather_backend_features(struct blkfront_info *info) · 353 unmodified lines
2281 if (xenbus_read_unsigned(info->xbdev->otherend, "feature-discard", 0))2285 if (xenbus_read_unsigned(info->xbdev->otherend, "feature-discard", 0))
2282 blkfront_setup_discard(info);2286 blkfront_setup_discard(info);
2283 2287
2284 if (feature_persistent)2288 if (info->feature_persistent_parm)
2285 info->feature_persistent =2289 info->feature_persistent =
2286 !!xenbus_read_unsigned(info->xbdev->otherend,2290 !!xenbus_read_unsigned(info->xbdev->otherend,
2287 "feature-persistent", 0);2291 "feature-persistent", 0);
drivers/xen/grant-table.c+3−0
@@ -1047,6 +1047,9 @@ int gnttab_dma_alloc_pages(struct gnttab_dma_alloc_args *args) · 1046 unmodified lines
1047 size_t size;1047 size_t size;
1048 int i, ret;1048 int i, ret;
1049 1049
1050 if (args->nr_pages < 0 || args->nr_pages > (INT_MAX >> PAGE_SHIFT))
1051 return -ENOMEM;
1052
1050 size = args->nr_pages << PAGE_SHIFT;1053 size = args->nr_pages << PAGE_SHIFT;
1051 if (args->coherent)1054 if (args->coherent)
1052 args->vaddr = dma_alloc_coherent(args->dev, size,1055 args->vaddr = dma_alloc_coherent(args->dev, size,