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

Changed files
+22 -10
drivers
+3
drivers/block/xen-blkback/common.h
··· 226 226 sector_t size; 227 227 unsigned int flush_support:1; 228 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 232 unsigned int feature_gnt_persistent:1; 230 233 unsigned int overflow_max_grants:1; 231 234 };
+4 -2
drivers/block/xen-blkback/xenbus.c
··· 907 907 xen_blkbk_barrier(xbt, be, be->blkif->vbd.flush_support); 908 908 909 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 911 if (err) { 912 912 xenbus_dev_fatal(dev, err, "writing %s/feature-persistent", 913 913 dev->nodename); ··· 1085 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 1091 xenbus_read_unsigned(dev->otherend, "feature-persistent", 0); 1090 1092 1091 1093 blkif->vbd.overflow_max_grants = 0;
+12 -8
drivers/block/xen-blkfront.c
··· 213 213 unsigned int feature_fua:1; 214 214 unsigned int feature_discard:1; 215 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 219 unsigned int feature_persistent:1; 217 220 unsigned int bounce:1; 218 221 unsigned int discard_granularity; ··· 1759 1756 return err; 1760 1757 } 1761 1758 1759 + /* Enable the persistent grants feature. */ 1760 + static bool feature_persistent = true; 1761 + module_param(feature_persistent, bool, 0644); 1762 + MODULE_PARM_DESC(feature_persistent, 1763 + "Enables the persistent grants feature"); 1764 + 1762 1765 /* Common code used when first setting up, and when resuming. */ 1763 1766 static int talk_to_blkback(struct xenbus_device *dev, 1764 1767 struct blkfront_info *info) ··· 1856 1847 message = "writing protocol"; 1857 1848 goto abort_transaction; 1858 1849 } 1850 + info->feature_persistent_parm = feature_persistent; 1859 1851 err = xenbus_printf(xbt, dev->nodename, "feature-persistent", "%u", 1860 - info->feature_persistent); 1852 + info->feature_persistent_parm); 1861 1853 if (err) 1862 1854 dev_warn(&dev->dev, 1863 1855 "writing persistent grants feature to xenbus"); ··· 1925 1915 } 1926 1916 return 0; 1927 1917 } 1928 - 1929 - /* Enable the persistent grants feature. */ 1930 - static bool feature_persistent = true; 1931 - module_param(feature_persistent, bool, 0644); 1932 - MODULE_PARM_DESC(feature_persistent, 1933 - "Enables the persistent grants feature"); 1934 1918 1935 1919 /* 1936 1920 * Entry point to this code when a new device is created. Allocate the basic ··· 2285 2281 if (xenbus_read_unsigned(info->xbdev->otherend, "feature-discard", 0)) 2286 2282 blkfront_setup_discard(info); 2287 2283 2288 - if (feature_persistent) 2284 + if (info->feature_persistent_parm) 2289 2285 info->feature_persistent = 2290 2286 !!xenbus_read_unsigned(info->xbdev->otherend, 2291 2287 "feature-persistent", 0);
+3
drivers/xen/grant-table.c
··· 1047 1047 size_t size; 1048 1048 int i, ret; 1049 1049 1050 + if (args->nr_pages < 0 || args->nr_pages > (INT_MAX >> PAGE_SHIFT)) 1051 + return -ENOMEM; 1052 + 1050 1053 size = args->nr_pages << PAGE_SHIFT; 1051 1054 if (args->coherent) 1052 1055 args->vaddr = dma_alloc_coherent(args->dev, size,