4.11.3-stable review
Subsystems (7)
Greg Kroah-Hartman
maintainerPATCH 178/197 PCI: hv: Specify CPU_AFFINITY_ALL for MSI affinity when >= 32 CPUs
In reply to Greg Kroah-Hartman4.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: K. Y. Srinivasan <[email protected]>
commit 433fcf6b7b31f1f233dd50aeb9d066a0f6ed4b9d upstream.
When we have 32 or more CPUs in the affinity mask, we should use a special constant to specify that to the host. Fix this issue.
--- drivers/pci/host/pci-hyperv.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/pci/host/pci-hyperv.c +8 -3
@@ -72,6 +72,7 @@ enum { PCI_PROTOCOL_VERSION_CURRENT = PCI_PROTOCOL_VERSION_1_1 }; +#define CPU_AFFINITY_ALL -1ULL#define PCI_CONFIG_MMIO_LENGTH 0x2000#define CFG_PAGE_OFFSET 0x1000#define CFG_PAGE_SIZE (PCI_CONFIG_MMIO_LENGTH - CFG_PAGE_OFFSET)
@@ -897,9 +898,13 @@ static void hv_compose_msi_msg(struct ir* processors because Hyper-V only supports 64 in a guest. */ affinity =irq_data_get_affinity_mask (data); -for_each_cpu_and (cpu, affinity, cpu_online_mask) { - int_pkt->int_desc.cpu_mask |= - (1ULL <<vmbus_cpu_number_to_vp_number (cpu)); +if (cpumask_weight (affinity) >=32 ) { + int_pkt->int_desc.cpu_mask =CPU_AFFINITY_ALL ; + }else { +for_each_cpu_and (cpu, affinity, cpu_online_mask) { + int_pkt->int_desc.cpu_mask |= + (1ULL <<vmbus_cpu_number_to_vp_number (cpu)); + } } ret = vmbus_sendpacket(hpdev->hbus->hdev->channel, int_pkt,
Greg Kroah-Hartman
maintainerPATCH 179/197 PCI: Fix pci_mmap_fits() for HAVE_PCI_RESOURCE_TO_USER platforms
In reply to Greg Kroah-Hartman4.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Woodhouse <[email protected]>
commit 6bccc7f426abd640f08d8c75fb22f99483f201b4 upstream.
In the PCI_MMAP_PROCFS case when the address being passed by the user is a 'user visible' resource address based on the bus window, and not the actual contents of the resource, that's what we need to be checking it against.
--- drivers/pci/pci-sysfs.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/pci/pci-sysfs.c +7 -3
@@ -985,15 +985,19 @@ void pci_remove_legacy_files(struct pci_int pci_mmap_fits (struct pci_dev *pdev,int resno,struct vm_area_struct *vma,enum pci_mmap_api mmap_api) { -unsigned long nr, start, size, pci_start; +unsigned long nr, start, size; +resource_size_t pci_start =0 , pci_end;if (pci_resource_len (pdev, resno) ==0 )return 0 ; nr =vma_pages (vma); start = vma->vm_pgoff; size = ((pci_resource_len (pdev, resno) -1 ) >>PAGE_SHIFT ) +1 ; - pci_start = (mmap_api ==PCI_MMAP_PROCFS ) ? -pci_resource_start (pdev, resno) >>PAGE_SHIFT :0 ; +if (mmap_api ==PCI_MMAP_PROCFS ) { +pci_resource_to_user (pdev, resno, &pdev->resource[resno], + &pci_start, &pci_end); + pci_start >>=PAGE_SHIFT ; + }if (start >= pci_start && start < pci_start + size && start + nr <= pci_start + size)return 1 ;
Greg Kroah-Hartman
maintainerPATCH 180/197 PCI: Fix another sanity check bug in /proc/pci mmap
In reply to Greg Kroah-Hartman4.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Woodhouse <[email protected]>
commit 17caf56731311c9596e7d38a70c88fcb6afa6a1b upstream.
Don't match MMIO maps with I/O BARs and vice versa.
--- drivers/pci/proc.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/pci/proc.c +8 -2
@@ -231,14 +231,20 @@ static int proc_bus_pci_mmap(struct file {struct pci_dev *dev =PDE_DATA (file_inode (file));struct pci_filp_private *fpriv = file->private_data; -int i, ret, write_combine; +int i, ret, write_combine, res_bit;if (!capable (CAP_SYS_RAWIO ))return -EPERM ; +if (fpriv->mmap_state == pci_mmap_io) + res_bit =IORESOURCE_IO ; +else + res_bit =IORESOURCE_MEM ; +/* Make sure the caller is mapping a real resource for this device */ for (i =0 ; i <PCI_ROM_RESOURCE ; i++) { -if (pci_mmap_fits (dev, i, vma,PCI_MMAP_PROCFS )) +if (dev->resource[i].flags & res_bit && +pci_mmap_fits (dev, i, vma,PCI_MMAP_PROCFS ))break ; }
Greg Kroah-Hartman
maintainerPATCH 181/197 PCI: Only allow WC mmap on prefetchable resources
In reply to Greg Kroah-Hartman4.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Woodhouse <[email protected]>
commit cef4d02305a06be581bb7f4353446717a1b319ec upstream.
The /proc/bus/pci mmap interface allows the user to specify whether they want WC or not. Don't let them do so on non-prefetchable BARs.
--- drivers/pci/proc.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/pci/proc.c +8 -5
@@ -231,7 +231,7 @@ static int proc_bus_pci_mmap(struct file {struct pci_dev *dev =PDE_DATA (file_inode (file));struct pci_filp_private *fpriv = file->private_data; -int i, ret, write_combine, res_bit; +int i, ret, write_combine =0 , res_bit;if (!capable (CAP_SYS_RAWIO ))return -EPERM ;
@@ -251,10 +251,13 @@ static int proc_bus_pci_mmap(struct fileif (i >=PCI_ROM_RESOURCE )return -ENODEV ; -if (fpriv->mmap_state == pci_mmap_mem) - write_combine = fpriv->write_combine; -else - write_combine =0 ; +if (fpriv->mmap_state == pci_mmap_mem && + fpriv->write_combine) { +if (dev->resource[i].flags &IORESOURCE_PREFETCH ) + write_combine =1 ; +else +return -EINVAL ; + } ret =pci_mmap_page_range (dev, vma, fpriv->mmap_state, write_combine);if (ret <0 )
Greg Kroah-Hartman
maintainerPATCH 183/197 mtd: nand: orion: fix clk handling
In reply to Greg Kroah-Hartman4.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Simon Baatz <[email protected]>
commit 675b11d94ce9baa5eb365a51b35d2793f77c8ab8 upstream.
The clk handling in orion_nand.c had two problems:
- In the probe function, clk_put() was called for an enabled clock, which violates the API (see documentation for clk_put() in include/linux/clk.h)
- In the error path of the probe function, clk_put() could be called twice for the same clock.
In order to clean this up, use the managed function devm_clk_get() and store the pointer to the clk in the driver data.
--- drivers/mtd/nand/orion_nand.c | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-)
drivers/mtd/nand/orion_nand.c +21 -21
@@ -23,6 +23,11 @@#include <asm/sizes.h> #include <linux/platform_data/mtd-orion_nand.h> +struct orion_nand_info { +struct nand_chip chip; +struct clk *clk; +}; +static void orion_nand_cmd_ctrl (struct mtd_info *mtd,int cmd,unsigned int ctrl) {struct nand_chip *nc =mtd_to_nand (mtd);
@@ -75,20 +80,21 @@ static void orion_nand_read_buf(struct mstatic int __init orion_nand_probe (struct platform_device *pdev) { +struct orion_nand_info *info;struct mtd_info *mtd;struct nand_chip *nc;struct orion_nand_data *board;struct resource *res; -struct clk *clk;void __iomem *io_base;int ret =0 ;u32 val =0 ; - nc =devm_kzalloc (&pdev->dev, -sizeof (struct nand_chip ), + info =devm_kzalloc (&pdev->dev, +sizeof (struct orion_nand_info ),GFP_KERNEL ); -if (!nc) +if (!info)return -ENOMEM ; + nc = &info->chip; mtd =nand_to_mtd (nc); res =platform_get_resource (pdev,IORESOURCE_MEM ,0 );
@@ -145,15 +151,13 @@ static int __init orion_nand_probe(strucif (board->dev_ready) nc->dev_ready = board->dev_ready; -platform_set_drvdata (pdev, mtd); +platform_set_drvdata (pdev, info);/* Not all platforms can gate the clock, so it is not an error if the clock does not exists. */ - clk =clk_get (&pdev->dev,NULL ); -if (!IS_ERR (clk)) { -clk_prepare_enable (clk); -clk_put (clk); - } + info->clk =devm_clk_get (&pdev->dev,NULL ); +if (!IS_ERR (info->clk)) +clk_prepare_enable (info->clk); ret =nand_scan (mtd,1 );if (ret)
@@ -169,26 +173,22 @@ static int __init orion_nand_probe(strucreturn 0 ; no_dev: -if (!IS_ERR (clk)) { -clk_disable_unprepare (clk); -clk_put (clk); - } +if (!IS_ERR (info->clk)) +clk_disable_unprepare (info->clk);return ret; }static int orion_nand_remove (struct platform_device *pdev) { -struct mtd_info *mtd =platform_get_drvdata (pdev); -struct clk *clk; +struct orion_nand_info *info =platform_get_drvdata (pdev); +struct nand_chip *chip = &info->chip; +struct mtd_info *mtd =nand_to_mtd (chip);nand_release (mtd); - clk =clk_get (&pdev->dev,NULL ); -if (!IS_ERR (clk)) { -clk_disable_unprepare (clk); -clk_put (clk); - } +if (!IS_ERR (info->clk)) +clk_disable_unprepare (info->clk);return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 184/197 mtd: nand: omap2: Fix partition creation via cmdline mtdparts
In reply to Greg Kroah-Hartman4.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Roger Quadros <[email protected]>
commit 2d283ede59869159f4bb84ae689258c5caffce54 upstream.
commit c9711ec5250b ("mtd: nand: omap: Clean up device tree support") caused the parent device name to be changed from "omap2-nand.0" to "<base address>.nand" (e.g. 30000000.nand on omap3 platforms). This caused mtd->name to be changed as well. This breaks partition creation via mtdparts passed by u-boot as it uses "omap2-nand.0" for the mtd-id.
Fix this by explicitly setting the mtd->name to "omap2-nand.<CS number>" if it isn't already set by nand_set_flash_node(). CS number is the NAND controller instance ID.
--- drivers/mtd/nand/omap2.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/mtd/nand/omap2.c +9 -0
@@ -1856,6 +1856,15 @@ static int omap_nand_probe(struct platfo nand_chip->ecc.priv =NULL ;nand_set_flash_node (nand_chip, dev->of_node); +if (!mtd->name) { + mtd->name =devm_kasprintf (&pdev->dev,GFP_KERNEL , +"omap2-nand.%d" , info->gpmc_cs); +if (!mtd->name) { +dev_err (&pdev->dev,"Failed to set MTD name\n" ); +return -ENOMEM ; + } + } + res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); nand_chip->IO_ADDR_R =devm_ioremap_resource (&pdev->dev, res);if (IS_ERR (nand_chip->IO_ADDR_R))
Greg Kroah-Hartman
maintainerPATCH 185/197 mtd: nand: add ooblayout for old hamming layout
In reply to Greg Kroah-Hartman4.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Couzens <[email protected]>
commit 6a623e07694437ad09f382a13f76cffc32239a7f upstream.
The old 1-bit hamming layout requires ECC data to be placed at a fixed offset, and not necessarily at the end of the OOB area. Add this old layout back in order to fix legacy setups.
--- drivers/mtd/nand/nand_base.c | 70 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 69 insertions(+), 1 deletion(-)
drivers/mtd/nand/nand_base.c +69 -1
@@ -139,6 +139,74 @@ const struct mtd_ooblayout_ops nand_oobl };EXPORT_SYMBOL_GPL (nand_ooblayout_lp_ops); +/* +* Support the old "large page" layout used for 1-bit Hamming ECC where ECC +* are placed at a fixed offset. +*/ +static int nand_ooblayout_ecc_lp_hamming (struct mtd_info *mtd,int section, +struct mtd_oob_region *oobregion) +{ +struct nand_chip *chip =mtd_to_nand (mtd); +struct nand_ecc_ctrl *ecc = &chip->ecc; + +if (section) +return -ERANGE ; + +switch (mtd->oobsize) { +case 64 : + oobregion->offset =40 ; +break ; +case 128 : + oobregion->offset =80 ; +break ; +default : +return -EINVAL ; + } + + oobregion->length = ecc->total; +if (oobregion->offset + oobregion->length > mtd->oobsize) +return -ERANGE ; + +return 0 ; +} + +static int nand_ooblayout_free_lp_hamming (struct mtd_info *mtd,int section, +struct mtd_oob_region *oobregion) +{ +struct nand_chip *chip =mtd_to_nand (mtd); +struct nand_ecc_ctrl *ecc = &chip->ecc; +int ecc_offset =0 ; + +if (section <0 || section >1 ) +return -ERANGE ; + +switch (mtd->oobsize) { +case 64 : + ecc_offset =40 ; +break ; +case 128 : + ecc_offset =80 ; +break ; +default : +return -EINVAL ; + } + +if (section ==0 ) { + oobregion->offset =2 ; + oobregion->length = ecc_offset -2 ; + }else { + oobregion->offset = ecc_offset + ecc->total; + oobregion->length = mtd->oobsize - oobregion->offset; + } + +return 0 ; +} + +const struct mtd_ooblayout_ops nand_ooblayout_lp_hamming_ops = { + .ecc = nand_ooblayout_ecc_lp_hamming, + .free = nand_ooblayout_free_lp_hamming, +}; +static int check_offs_len (struct mtd_info *mtd,loff_t ofs,uint64_t len) {
@@ -4653,7 +4721,7 @@ int nand_scan_tail(struct mtd_info *mtd)break ;case 64 :case 128 : -mtd_set_ooblayout (mtd, &nand_ooblayout_lp_ops); +mtd_set_ooblayout (mtd, &nand_ooblayout_lp_hamming_ops);break ;default : WARN(1, "No oob scheme defined for oobsize %d\n",
Greg Kroah-Hartman
maintainerPATCH 186/197 drm/edid: Add 10 bpc quirk for LGD 764 panel in HP zBook 17 G2
In reply to Greg Kroah-Hartman4.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mario Kleiner <[email protected]>
commit e345da82bd6bdfa8492f80b3ce4370acfd868d95 upstream.
The builtin eDP panel in the HP zBook 17 G2 supports 10 bpc, as advertised by the Laptops product specs and verified via injecting a fixed edid + photometer measurements, but edid reports unknown depth, so drivers fall back to 6 bpc.
Add a quirk to get the full 10 bpc.
--- drivers/gpu/drm/drm_edid.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/gpu/drm/drm_edid.c +8 -0
@@ -79,6 +79,8 @@#define EDID_QUIRK_FORCE_12BPC (1 << 9)/* Force 6bpc */ #define EDID_QUIRK_FORCE_6BPC (1 << 10) +/* Force 10bpc */ +#define EDID_QUIRK_FORCE_10BPC (1 << 11)struct detailed_mode_closure {struct drm_connector *connector;
@@ -121,6 +123,9 @@ static const struct edid_quirk { {"FCM" ,13600 ,EDID_QUIRK_PREFER_LARGE_75 | EDID_QUIRK_DETAILED_IN_CM }, +/* LGD panel of HP zBook 17 G2, eDP 10 bpc, but reports unknown bpc */ + { "LGD", 764, EDID_QUIRK_FORCE_10BPC }, +/* LG Philips LCD LP154W01-A5 */ { "LPL", 0, EDID_QUIRK_DETAILED_USE_MAXIMUM_SIZE }, { "LPL", 0x2a00, EDID_QUIRK_DETAILED_USE_MAXIMUM_SIZE },
@@ -4174,6 +4179,9 @@ int drm_add_edid_modes(struct drm_connecif (quirks &EDID_QUIRK_FORCE_8BPC ) connector->display_info.bpc =8 ; +if (quirks &EDID_QUIRK_FORCE_10BPC ) + connector->display_info.bpc =10 ; +if (quirks &EDID_QUIRK_FORCE_12BPC ) connector->display_info.bpc =12 ;
Greg Kroah-Hartman
maintainerPATCH 187/197 NFSv4: Fix a hang in OPEN related to server reboot
In reply to Greg Kroah-Hartman4.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Trond Myklebust <[email protected]>
commit 56e0d71ef12f026d96213e45a662bde6bbff4676 upstream.
If the server fails to return the attributes as part of an OPEN reply, and then reboots, we can end up hanging. The reason is that the client attempts to send a GETATTR in order to pick up the missing OPEN call, but fails to release the slot first, causing reboot recovery to deadlock.
--- fs/nfs/nfs4proc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/nfs/nfs4proc.c +3 -1
@@ -2300,8 +2300,10 @@ static int _nfs4_proc_open(struct nfs4_oif (status !=0 )return status; } -if (!(o_res->f_attr->valid &NFS_ATTR_FATTR )) +if (!(o_res->f_attr->valid &NFS_ATTR_FATTR )) { +nfs4_sequence_free_slot (&o_res->seq_res);nfs4_proc_getattr (server, &o_res->fh, o_res->f_attr, o_res->f_label); + }return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 188/197 NFS: Fix use after free in write error path
In reply to Greg Kroah-Hartman4.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fred Isaman <[email protected]>
commit 1f84ccdf37d0db3a70714d02d51b0b6d45887fb8 upstream.
--- fs/nfs/write.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfs/write.c +1 -1
@@ -548,9 +548,9 @@ static void nfs_write_error_remove_page( {nfs_unlock_request (req);nfs_end_page_writeback (req); -nfs_release_request (req);generic_error_remove_page (page_file_mapping (req->wb_page), req->wb_page); +nfs_release_request (req); }/*
Greg Kroah-Hartman
maintainerPATCH 189/197 NFS: Use GFP_NOIO for two allocations in writeback
In reply to Greg Kroah-Hartman4.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Benjamin Coddington <[email protected]>
commit ae97aa524ef495b6276fd26f5d5449fb22975d7c upstream.
Prevent a deadlock that can occur if we wait on allocations that try to write back our pages.
--- fs/nfs/pagelist.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
fs/nfs/pagelist.c +11 -4
@@ -29,13 +29,14 @@static struct kmem_cache *nfs_page_cachep;static const struct rpc_call_ops nfs_pgio_common_ops; -static bool nfs_pgarray_set (struct nfs_page_array *p,unsigned int pagecount) +static bool nfs_pgarray_set (struct nfs_page_array *p,unsigned int pagecount, +gfp_t gfp_flags) { p->npages = pagecount;if (pagecount <=ARRAY_SIZE (p->page_array)) p->pagevec = p->page_array;else { - p->pagevec =kcalloc (pagecount,sizeof (struct page *),GFP_KERNEL ); + p->pagevec =kcalloc (pagecount,sizeof (struct page *), gfp_flags);if (!p->pagevec) p->npages =0 ; }
@@ -681,6 +682,7 @@ void nfs_pageio_init(struct nfs_pageio_d {struct nfs_pgio_mirror *new;int i; +gfp_t gfp_flags =GFP_KERNEL ; desc->pg_moreio =0 ; desc->pg_inode = inode;
@@ -700,8 +702,10 @@ void nfs_pageio_init(struct nfs_pageio_dif (pg_ops->pg_get_mirror_count) {/* until we have a request, we don't have an lseg and no * idea how many mirrors there will be */ +if (desc->pg_rw_ops->rw_mode ==FMODE_WRITE ) + gfp_flags =GFP_NOIO ; new =kcalloc (NFS_PAGEIO_DESCRIPTOR_MIRROR_MAX , -sizeof (struct nfs_pgio_mirror ),GFP_KERNEL ); +sizeof (struct nfs_pgio_mirror ), gfp_flags); desc->pg_mirrors_dynamic = new; desc->pg_mirrors = new;
@@ -755,9 +759,12 @@ int nfs_generic_pgio(struct nfs_pageio_dstruct list_head *head = &mirror->pg_list;struct nfs_commit_info cinfo;unsigned int pagecount, pageused; +gfp_t gfp_flags =GFP_KERNEL ; pagecount =nfs_page_array_len (mirror->pg_base, mirror->pg_count); -if (!nfs_pgarray_set (&hdr->page_array, pagecount)) { +if (desc->pg_rw_ops->rw_mode ==FMODE_WRITE ) + gfp_flags =GFP_NOIO ; +if (!nfs_pgarray_set (&hdr->page_array, pagecount, gfp_flags)) {nfs_pgio_error (hdr); desc->pg_error = -ENOMEM ;return desc->pg_error;
Greg Kroah-Hartman
maintainerPATCH 190/197 pNFS/flexfiles: Check the result of nfs4_pnfs_ds_connect
In reply to Greg Kroah-Hartman4.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Trond Myklebust <[email protected]>
commit 260f32adb88dadfaac29f47f761a088238ca164c upstream.
The check in nfs4_ff_layout_prepare_ds() seems to be missing.
--- fs/nfs/flexfilelayout/flexfilelayoutdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfs/flexfilelayout/flexfilelayoutdev.c +1 -1
@@ -415,7 +415,7 @@ nfs4_ff_layout_prepare_ds(struct pnfs_la mirror->mirror_ds->ds_versions[0].minor_version);/* connect success, check rsize/wsize limit */ -if (ds->ds_clp) { +if (!status) { max_payload =nfs_block_size (rpc_max_payload (ds->ds_clp->cl_rpcclient),NULL );
Greg Kroah-Hartman
maintainerPATCH 191/197 NFSv4: Fix an rcu lock leak
In reply to Greg Kroah-Hartman4.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Trond Myklebust <[email protected]>
commit 2e84611b3f4fa50e1f4c12f2966fcc7fb955d944 upstream.
The intention in the original patch was to release the lock when we put the inode, however something got screwed up.
--- fs/nfs/callback_proc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
fs/nfs/callback_proc.c +4 -2
@@ -131,10 +131,11 @@ restart:if (!inode)continue ;if (!nfs_sb_active (inode->i_sb)) { -rcu_read_lock (); +rcu_read_unlock ();spin_unlock (&clp->cl_lock);iput (inode);spin_lock (&clp->cl_lock); +rcu_read_lock (); goto restart; }return inode;
@@ -170,10 +171,11 @@ restart:if (!inode)continue ;if (!nfs_sb_active (inode->i_sb)) { -rcu_read_lock (); +rcu_read_unlock ();spin_unlock (&clp->cl_lock);iput (inode);spin_lock (&clp->cl_lock); +rcu_read_lock (); goto restart; }return inode;
Greg Kroah-Hartman
maintainerPATCH 192/197 nfsd: fix undefined behavior in nfsd4_layout_verify
In reply to Greg Kroah-Hartman4.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ari Kauppi <[email protected]>
commit b550a32e60a4941994b437a8d662432a486235a5 upstream.
UBSAN: Undefined behaviour in fs/nfsd/nfs4proc.c:1262:34 shift exponent 128 is too large for 32-bit type 'int'
Depending on compiler+architecture, this may cause the check for layout_type to succeed for overly large values (which seems to be the case with amd64). The large value will be later used in de-referencing nfsd4_layout_ops for function pointers.
--- fs/nfsd/nfs4proc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/nfsd/nfs4proc.c +2 -1
@@ -1259,7 +1259,8 @@ nfsd4_layout_verify(struct svc_export *ereturn NULL ; } -if (!(exp->ex_layout_types & (1 << layout_type))) { +if (layout_type >=LAYOUT_TYPE_MAX || + !(exp->ex_layout_types & (1 << layout_type))) {dprintk ("%s: layout type %d not supported\n" , __func__, layout_type);return NULL ;
Greg Kroah-Hartman
maintainerPATCH 193/197 nfsd: encoders mustnt use unitialized values in error cases
In reply to Greg Kroah-Hartman4.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: J. Bruce Fields <[email protected]>
commit f961e3f2acae94b727380c0b74e2d3954d0edf79 upstream.
In error cases, lgp->lg_layout_type may be out of bounds; so we shouldn't be using it until after the check of nfserr.
This was seen to crash nfsd threads when the server receives a LAYOUTGET request with a large layout type.
GETDEVICEINFO has the same problem.
--- fs/nfsd/nfs4xdr.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
fs/nfsd/nfs4xdr.c +4 -4
@@ -4119,8 +4119,7 @@ nfsd4_encode_getdeviceinfo(struct nfsd4_ struct nfsd4_getdeviceinfo *gdev) {struct xdr_stream *xdr = &resp->xdr; -const struct nfsd4_layout_ops *ops = - nfsd4_layout_ops[gdev->gd_layout_type]; +const struct nfsd4_layout_ops *ops;u32 starting_len = xdr->buf->len, needed_len;__be32 *p;
@@ -4137,6 +4136,7 @@ nfsd4_encode_getdeviceinfo(struct nfsd4_/* If maxcount is 0 then just update notifications */ if (gdev->gd_maxcount !=0 ) { + ops = nfsd4_layout_ops[gdev->gd_layout_type]; nfserr = ops->encode_getdeviceinfo (xdr, gdev);if (nfserr) {/*
@@ -4189,8 +4189,7 @@ nfsd4_encode_layoutget(struct nfsd4_comp struct nfsd4_layoutget *lgp) {struct xdr_stream *xdr = &resp->xdr; -const struct nfsd4_layout_ops *ops = - nfsd4_layout_ops[lgp->lg_layout_type]; +const struct nfsd4_layout_ops *ops;__be32 *p;dprintk ("%s: err %d\n" , __func__, nfserr);
@@ -4213,6 +4212,7 @@ nfsd4_encode_layoutget(struct nfsd4_comp *p++ =cpu_to_be32 (lgp->lg_seg.iomode); *p++ =cpu_to_be32 (lgp->lg_layout_type); + ops = nfsd4_layout_ops[lgp->lg_layout_type]; nfserr = ops->encode_layoutget (xdr, lgp); out:kfree (lgp->lg_content);
Greg Kroah-Hartman
maintainerPATCH 194/197 nfsd: Fix up the "supattr_exclcreat" attributes
In reply to Greg Kroah-Hartman4.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Trond Myklebust <[email protected]>
commit b26b78cb726007533d81fdf90a62e915002ef5c8 upstream.
If an NFSv4 client asks us for the supattr_exclcreat, then we must not return attributes that are unsupported by this minor version.
--- fs/nfsd/nfs4xdr.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
fs/nfsd/nfs4xdr.c +8 -3
@@ -2831,9 +2831,14 @@ out_acl: }#endif /* CONFIG_NFSD_PNFS */ if (bmval2 &FATTR4_WORD2_SUPPATTR_EXCLCREAT ) { - status =nfsd4_encode_bitmap (xdr,NFSD_SUPPATTR_EXCLCREAT_WORD0 , -NFSD_SUPPATTR_EXCLCREAT_WORD1 , -NFSD_SUPPATTR_EXCLCREAT_WORD2 ); +u32 supp[3 ]; + +memcpy (supp, nfsd_suppattrs[minorversion],sizeof (supp)); + supp[0 ] &=NFSD_SUPPATTR_EXCLCREAT_WORD0 ; + supp[1 ] &=NFSD_SUPPATTR_EXCLCREAT_WORD1 ; + supp[2 ] &=NFSD_SUPPATTR_EXCLCREAT_WORD2 ; + + status =nfsd4_encode_bitmap (xdr, supp[0 ], supp[1 ], supp[2 ]);if (status) goto out; }
Greg Kroah-Hartman
maintainerPATCH 195/197 drivers: char: mem: Check for address space wraparound with mmap()
In reply to Greg Kroah-Hartman4.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Julius Werner <[email protected]>
commit b299cde245b0b76c977f4291162cf668e087b408 upstream.
/dev/mem currently allows mmap() mappings that wrap around the end of the physical address space, which should probably be illegal. It circumvents the existing STRICT_DEVMEM permission check because the loop immediately terminates (as the start address is already higher than the end address). On the x86_64 architecture it will then cause a panic (from the BUG(start >= end) in arch/x86/mm/pat.c:reserve_memtype()).
This patch adds an explicit check to make sure offset + size will not wrap around in the physical address type.
--- drivers/char/mem.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/char/mem.c +5 -0
@@ -340,6 +340,11 @@ static const struct vm_operations_structstatic int mmap_mem (struct file *file,struct vm_area_struct *vma) {size_t size = vma->vm_end - vma->vm_start; +phys_addr_t offset = (phys_addr_t )vma->vm_pgoff <<PAGE_SHIFT ; + +/* It's illegal to wrap around the end of the physical address space. */ +if (offset + (phys_addr_t )size < offset) +return -EINVAL ;if (!valid_mmap_phys_addr_range (vma->vm_pgoff, size))return -EINVAL ;
Greg Kroah-Hartman
maintainerPATCH 196/197 drm/i915/gvt: Disable access to stolen memory as a guest
In reply to Greg Kroah-Hartman4.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Wilson <[email protected]>
commit 04a68a35ce6d7b54749989f943993020f48fed62 upstream.
Explicitly disable stolen memory when running as a guest in a virtual machine, since the memory is not mediated between clients and reserved entirely for the host. The actual size should be reported as zero, but like every other quirk we want to tell the user what is happening.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99028
--- drivers/gpu/drm/i915/i915_gem_stolen.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpu/drm/i915/i915_gem_stolen.c +5 -0
@@ -410,6 +410,11 @@ int i915_gem_init_stolen(struct drm_i915return 0 ; } +if (intel_vgpu_active (dev_priv)) { +DRM_INFO ("iGVT-g active, disabling use of stolen memory\n" ); +return 0 ; + } +#ifdef CONFIG_INTEL_IOMMU if (intel_iommu_gfx_mapped &&INTEL_GEN (dev_priv) <8 ) {DRM_INFO ("DMAR active, disabling use of stolen memory\n" );
Greg Kroah-Hartman
maintainerPATCH 197/197 IB/hfi1: Protect the global dev_cntr_names and port_cntr_names
In reply to Greg Kroah-Hartman4.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tadeusz Struk <[email protected]>
commit 62eed66e98b4c2286fef2ce5911d8d75b7515f7b upstream.
Protect the global dev_cntr_names and port_cntr_names with the global mutex as they are allocated and freed in a function called per device. Otherwise there is a danger of double free and memory leaks.
--- drivers/infiniband/hw/hfi1/verbs.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/infiniband/hw/hfi1/verbs.c +11 -1
@@ -1524,6 +1524,7 @@ static const char * const driver_cntr_na "DRIVER_EgrHdrFull" }; +static DEFINE_MUTEX (cntr_names_lock);/* protects the *_cntr_names bufers */ static const char **dev_cntr_names;static const char **port_cntr_names;static int num_driver_cntrs =ARRAY_SIZE (driver_cntr_names);
@@ -1578,6 +1579,7 @@ static struct rdma_hw_stats *alloc_hw_st {int i, err; +mutex_lock (&cntr_names_lock);if (!cntr_names_initialized) {struct hfi1_devdata *dd =dd_from_ibdev (ibdev);
@@ -1586,8 +1588,10 @@ static struct rdma_hw_stats *alloc_hw_st num_driver_cntrs, &num_dev_cntrs, &dev_cntr_names); -if (err) +if (err) { +mutex_unlock (&cntr_names_lock);return NULL ; + }for (i =0 ; i < num_driver_cntrs; i++) dev_cntr_names[num_dev_cntrs + i] =
@@ -1601,10 +1605,12 @@ static struct rdma_hw_stats *alloc_hw_stif (err) {kfree (dev_cntr_names); dev_cntr_names =NULL ; +mutex_unlock (&cntr_names_lock);return NULL ; } cntr_names_initialized =1 ; } +mutex_unlock (&cntr_names_lock);if (!port_num) return rdma_alloc_hw_stats_struct(
@@ -1823,9 +1829,13 @@ void hfi1_unregister_ib_device(struct hfdel_timer_sync (&dev->mem_timer);verbs_txreq_exit (dev); +mutex_lock (&cntr_names_lock);kfree (dev_cntr_names);kfree (port_cntr_names); + dev_cntr_names =NULL ; + port_cntr_names =NULL ; cntr_names_initialized =0 ; +mutex_unlock (&cntr_names_lock); }void hfi1_cnp_rcv (struct hfi1_packet *packet)
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.11.3 release. There are 197 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu May 25 20:07:44 UTC 2017. Anything received after that time might be too late.
Build results:
total: 145 pass: 145 fail: 0 Qemu test results: total: 122 pass: 122 fail: 0
Details are available at http://kerneltests.org/builders.
Guenter