From: Greg Kroah-Hartman Date: Wed, 28 Feb 2018 15:14:15 +0000 (+0100) Subject: 4.9-stable patches X-Git-Tag: v3.18.98~11 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a0d5a3d3a23d56effb8edebe2664c26c65a08bae;p=thirdparty%2Fkernel%2Fstable-queue.git 4.9-stable patches added patches: arm-8731-1-fix-csum_partial_copy_from_user-stack-mismatch.patch arm-dts-ls1021a-fix-incorrect-clock-references.patch asoc-nau8825-fix-issue-that-pop-noise-when-start-capture.patch bnx2x-improve-reliability-in-case-of-nested-pci-errors.patch bnxt_en-fix-the-invalid-vf-id-check-in-bnxt_vf_ndo_prep-routine.patch can-flex_can-correct-the-checking-for-frame-length-in-flexcan_start_xmit.patch dmaengine-fsl-edma-disable-clks-on-all-error-paths.patch drm-nouveau-pci-do-a-msi-rearm-on-init.patch drm-ttm-check-the-return-value-of-kzalloc.patch e1000-fix-disabling-already-disabled-warning.patch genirq-guard-handle_bad_irq-log-messages.patch i40e-i40evf-account-for-frags-split-over-multiple-descriptors-in-check-linearize.patch ib-ipoib-fix-race-condition-in-neigh-creation.patch ib-mlx4-fix-mlx4_ib_alloc_mr-error-flow.patch ib-mlx5-fix-mlx5_ib_alloc_mr-error-flow.patch ip6_tunnel-get-the-min-mtu-properly-in-ip6_tnl_xmit.patch ipv6-icmp6-allow-icmp-messages-to-be-looped-back.patch led-core-fix-brightness-setting-when-setting-delay_off-0.patch lib-mpi-fix-umul_ppmm-for-mips64r6.patch mac80211-mesh-drop-frames-appearing-to-be-from-us.patch mac80211_hwsim-fix-a-possible-sleep-in-atomic-bug-in-hwsim_get_radio_nl.patch macvlan-fix-one-possible-double-free.patch mdio-sun4i-fix-a-memory-leak.patch mtd-nand-brcmnand-zero-bitflip-is-not-an-error.patch mtd-nand-gpmi-fix-failure-when-a-erased-page-has-a-bitflip-at-bbm.patch net-arc_emac-fix-arc_emac_rx-error-paths.patch net-gianfar_ptp-move-set_fipers-to-spinlock-protecting-area.patch net-mediatek-setup-proper-state-for-disabled-gmac-on-the-default.patch net-phy-xgene-disable-clk-on-error-paths.patch net-stmmac-fix-tx-timestamp-calculation.patch net-usb-qmi_wwan-add-support-for-yuga-clm920-nc5-pid-0x9625.patch net-usb-qmi_wwan-add-telit-me910-pid-0x1101-support.patch nl80211-check-for-the-required-netlink-attribute-presence.patch nvme-check-hw-sectors-before-setting-chunk-sectors.patch s390-dasd-fix-wrongly-assigned-configuration-data.patch scsi-storvsc-fix-scsi_cmd-error-assignments-in-storvsc_handle_error.patch sctp-make-use-of-pre-calculated-len.patch sget-handle-failures-of-register_shrinker.patch solutionengine771x-fix-ether-platform-data.patch spi-atmel-fixed-spin_lock-usage-inside-atmel_spi_remove.patch tg3-add-workaround-to-restrict-5762-mrrs-to-2048.patch tg3-enable-phy-reset-in-mtu-change-path-for-5720.patch tipc-error-path-leak-fixes-in-tipc_enable_bearer.patch tipc-fix-tipc_mon_delete-oops-in-tipc_enable_bearer-error-path.patch uapi-libc-compat-add-fallback-for-unsupported-libcs.patch x86-asm-allow-again-using-asm.h-when-building-for-the-bpf-clang-target.patch xen-gntdev-fix-off-by-one-error-when-unmapping-with-holes.patch xen-gntdev-fix-partial-gntdev_mmap-cleanup.patch xen-netfront-enable-device-after-manual-module-load.patch xfs-quota-check-result-of-register_shrinker.patch xfs-quota-fix-missed-destroy-of-qi_tree_lock.patch --- diff --git a/queue-4.9/arm-8731-1-fix-csum_partial_copy_from_user-stack-mismatch.patch b/queue-4.9/arm-8731-1-fix-csum_partial_copy_from_user-stack-mismatch.patch new file mode 100644 index 00000000000..38af5bf80e4 --- /dev/null +++ b/queue-4.9/arm-8731-1-fix-csum_partial_copy_from_user-stack-mismatch.patch @@ -0,0 +1,43 @@ +From foo@baz Wed Feb 28 16:13:29 CET 2018 +From: Chunyan Zhang +Date: Fri, 1 Dec 2017 03:51:04 +0100 +Subject: ARM: 8731/1: Fix csum_partial_copy_from_user() stack mismatch + +From: Chunyan Zhang + + +[ Upstream commit 36b0cb84ee858f02c256d26f0cb4229c78e3399e ] + +An additional 'ip' will be pushed to the stack, for restoring the +DACR later, if CONFIG_CPU_SW_DOMAIN_PAN defined. + +However, the fixup still get the err_ptr by add #8*4 to sp, which +results in the fact that the code area pointed by the LR will be +overwritten, or the kernel will crash if CONFIG_DEBUG_RODATA is enabled. + +This patch fixes the stack mismatch. + +Fixes: a5e090acbf54 ("ARM: software-based priviledged-no-access support") +Signed-off-by: Lvqiang Huang +Signed-off-by: Chunyan Zhang +Signed-off-by: Russell King +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + arch/arm/lib/csumpartialcopyuser.S | 4 ++++ + 1 file changed, 4 insertions(+) + +--- a/arch/arm/lib/csumpartialcopyuser.S ++++ b/arch/arm/lib/csumpartialcopyuser.S +@@ -85,7 +85,11 @@ + .pushsection .text.fixup,"ax" + .align 4 + 9001: mov r4, #-EFAULT ++#ifdef CONFIG_CPU_SW_DOMAIN_PAN ++ ldr r5, [sp, #9*4] @ *err_ptr ++#else + ldr r5, [sp, #8*4] @ *err_ptr ++#endif + str r4, [r5] + ldmia sp, {r1, r2} @ retrieve dst, len + add r2, r2, r1 diff --git a/queue-4.9/arm-dts-ls1021a-fix-incorrect-clock-references.patch b/queue-4.9/arm-dts-ls1021a-fix-incorrect-clock-references.patch new file mode 100644 index 00000000000..a686a0220f8 --- /dev/null +++ b/queue-4.9/arm-dts-ls1021a-fix-incorrect-clock-references.patch @@ -0,0 +1,52 @@ +From foo@baz Wed Feb 28 16:13:29 CET 2018 +From: Arnd Bergmann +Date: Thu, 21 Dec 2017 22:35:19 +0100 +Subject: ARM: dts: ls1021a: fix incorrect clock references + +From: Arnd Bergmann + + +[ Upstream commit 506e8a912661c97b41adc8a286b875d01323ec45 ] + +dtc warns about two 'clocks' properties that have an extraneous '1' +at the end: + +arch/arm/boot/dts/ls1021a-qds.dtb: Warning (clocks_property): arch/arm/boot/dts/ls1021a-twr.dtb: Warning (clocks_property): Property 'clocks', cell 1 is not a phandle reference in /soc/i2c@2180000/mux@77/i2c@4/sgtl5000@2a +arch/arm/boot/dts/ls1021a-qds.dtb: Warning (clocks_property): Missing property '#clock-cells' in node /soc/interrupt-controller@1400000 or bad phandle (referred from /soc/i2c@2180000/mux@77/i2c@4/sgtl5000@2a:clocks[1]) +Property 'clocks', cell 1 is not a phandle reference in /soc/i2c@2190000/sgtl5000@a +arch/arm/boot/dts/ls1021a-twr.dtb: Warning (clocks_property): Missing property '#clock-cells' in node /soc/interrupt-controller@1400000 or bad phandle (referred from /soc/i2c@2190000/sgtl5000@a:clocks[1]) + +The clocks that get referenced here are fixed-rate, so they do not +take any argument, and dtc interprets the next cell as a phandle, which +is invalid. + +Signed-off-by: Arnd Bergmann +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + arch/arm/boot/dts/ls1021a-qds.dts | 2 +- + arch/arm/boot/dts/ls1021a-twr.dts | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +--- a/arch/arm/boot/dts/ls1021a-qds.dts ++++ b/arch/arm/boot/dts/ls1021a-qds.dts +@@ -215,7 +215,7 @@ + reg = <0x2a>; + VDDA-supply = <®_3p3v>; + VDDIO-supply = <®_3p3v>; +- clocks = <&sys_mclk 1>; ++ clocks = <&sys_mclk>; + }; + }; + }; +--- a/arch/arm/boot/dts/ls1021a-twr.dts ++++ b/arch/arm/boot/dts/ls1021a-twr.dts +@@ -187,7 +187,7 @@ + reg = <0x0a>; + VDDA-supply = <®_3p3v>; + VDDIO-supply = <®_3p3v>; +- clocks = <&sys_mclk 1>; ++ clocks = <&sys_mclk>; + }; + }; + diff --git a/queue-4.9/asoc-nau8825-fix-issue-that-pop-noise-when-start-capture.patch b/queue-4.9/asoc-nau8825-fix-issue-that-pop-noise-when-start-capture.patch new file mode 100644 index 00000000000..83eebdf4717 --- /dev/null +++ b/queue-4.9/asoc-nau8825-fix-issue-that-pop-noise-when-start-capture.patch @@ -0,0 +1,32 @@ +From foo@baz Wed Feb 28 16:13:29 CET 2018 +From: Abhijeet Kumar +Date: Tue, 12 Dec 2017 00:40:25 +0530 +Subject: ASoC: nau8825: fix issue that pop noise when start capture + +From: Abhijeet Kumar + + +[ Upstream commit d070f7c703ef26e3db613f24206823f916272fc6 ] + +In skylake platform, we hear a loud pop noise(0 dB) at start of +audio capture power up sequence. This patch removes the pop noise +from the recording by adding a delay before enabling ADC. + +Signed-off-by: Abhijeet Kumar +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + sound/soc/codecs/nau8825.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/sound/soc/codecs/nau8825.c ++++ b/sound/soc/codecs/nau8825.c +@@ -882,6 +882,7 @@ static int nau8825_adc_event(struct snd_ + + switch (event) { + case SND_SOC_DAPM_POST_PMU: ++ msleep(125); + regmap_update_bits(nau8825->regmap, NAU8825_REG_ENA_CTRL, + NAU8825_ENABLE_ADC, NAU8825_ENABLE_ADC); + break; diff --git a/queue-4.9/bnx2x-improve-reliability-in-case-of-nested-pci-errors.patch b/queue-4.9/bnx2x-improve-reliability-in-case-of-nested-pci-errors.patch new file mode 100644 index 00000000000..1a250b0f037 --- /dev/null +++ b/queue-4.9/bnx2x-improve-reliability-in-case-of-nested-pci-errors.patch @@ -0,0 +1,90 @@ +From foo@baz Wed Feb 28 16:13:29 CET 2018 +From: "Guilherme G. Piccoli" +Date: Fri, 22 Dec 2017 13:01:39 -0200 +Subject: bnx2x: Improve reliability in case of nested PCI errors + +From: "Guilherme G. Piccoli" + + +[ Upstream commit f7084059a9cb9e56a186e1677b1dcffd76c2cd24 ] + +While in recovery process of PCI error (called EEH on PowerPC arch), +another PCI transaction could be corrupted causing a situation of +nested PCI errors. Also, this scenario could be reproduced with +error injection mechanisms (for debug purposes). + +We observe that in case of nested PCI errors, bnx2x might attempt to +initialize its shmem and cause a kernel crash due to bad addresses +read from MCP. Multiple different stack traces were observed depending +on the point the second PCI error happens. + +This patch avoids the crashes by: + + * failing PCI recovery in case of nested errors (since multiple + PCI errors in a row are not expected to lead to a functional + adapter anyway), and by, + + * preventing access to adapter FW when MCP is failed (we mark it as + failed when shmem cannot get initialized properly). + +Reported-by: Abdul Haleem +Signed-off-by: Guilherme G. Piccoli +Acked-by: Shahed Shaikh +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | 4 ++-- + drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 14 +++++++++++++- + 2 files changed, 15 insertions(+), 3 deletions(-) + +--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c ++++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +@@ -3034,7 +3034,7 @@ int bnx2x_nic_unload(struct bnx2x *bp, i + + del_timer_sync(&bp->timer); + +- if (IS_PF(bp)) { ++ if (IS_PF(bp) && !BP_NOMCP(bp)) { + /* Set ALWAYS_ALIVE bit in shmem */ + bp->fw_drv_pulse_wr_seq |= DRV_PULSE_ALWAYS_ALIVE; + bnx2x_drv_pulse(bp); +@@ -3120,7 +3120,7 @@ int bnx2x_nic_unload(struct bnx2x *bp, i + bp->cnic_loaded = false; + + /* Clear driver version indication in shmem */ +- if (IS_PF(bp)) ++ if (IS_PF(bp) && !BP_NOMCP(bp)) + bnx2x_update_mng_version(bp); + + /* Check if there are pending parity attentions. If there are - set +--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c ++++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +@@ -9578,6 +9578,15 @@ static int bnx2x_init_shmem(struct bnx2x + + do { + bp->common.shmem_base = REG_RD(bp, MISC_REG_SHARED_MEM_ADDR); ++ ++ /* If we read all 0xFFs, means we are in PCI error state and ++ * should bail out to avoid crashes on adapter's FW reads. ++ */ ++ if (bp->common.shmem_base == 0xFFFFFFFF) { ++ bp->flags |= NO_MCP_FLAG; ++ return -ENODEV; ++ } ++ + if (bp->common.shmem_base) { + val = SHMEM_RD(bp, validity_map[BP_PORT(bp)]); + if (val & SHR_MEM_VALIDITY_MB) +@@ -14312,7 +14321,10 @@ static pci_ers_result_t bnx2x_io_slot_re + BNX2X_ERR("IO slot reset --> driver unload\n"); + + /* MCP should have been reset; Need to wait for validity */ +- bnx2x_init_shmem(bp); ++ if (bnx2x_init_shmem(bp)) { ++ rtnl_unlock(); ++ return PCI_ERS_RESULT_DISCONNECT; ++ } + + if (IS_PF(bp) && SHMEM2_HAS(bp, drv_capabilities_flag)) { + u32 v; diff --git a/queue-4.9/bnxt_en-fix-the-invalid-vf-id-check-in-bnxt_vf_ndo_prep-routine.patch b/queue-4.9/bnxt_en-fix-the-invalid-vf-id-check-in-bnxt_vf_ndo_prep-routine.patch new file mode 100644 index 00000000000..4d25af77e6d --- /dev/null +++ b/queue-4.9/bnxt_en-fix-the-invalid-vf-id-check-in-bnxt_vf_ndo_prep-routine.patch @@ -0,0 +1,40 @@ +From foo@baz Wed Feb 28 16:13:29 CET 2018 +From: Venkat Duvvuru +Date: Thu, 4 Jan 2018 18:46:55 -0500 +Subject: bnxt_en: Fix the 'Invalid VF' id check in bnxt_vf_ndo_prep routine. + +From: Venkat Duvvuru + + +[ Upstream commit 78f300049335ae81a5cc6b4b232481dc5e1f9d41 ] + +In bnxt_vf_ndo_prep (which is called by bnxt_get_vf_config ndo), there is a +check for "Invalid VF id". Currently, the check is done against max_vfs. +However, the user doesn't always create max_vfs. So, the check should be +against the created number of VFs. The number of bnxt_vf_info structures +that are allocated in bnxt_alloc_vf_resources routine is the "number of +requested VFs". So, if an "invalid VF id" falls between the requested +number of VFs and the max_vfs, the driver will be dereferencing an invalid +pointer. + +Fixes: c0c050c58d84 ("bnxt_en: New Broadcom ethernet driver.") +Signed-off-by: Venkat Devvuru +Signed-off-by: Michael Chan +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c ++++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c +@@ -68,7 +68,7 @@ static int bnxt_vf_ndo_prep(struct bnxt + netdev_err(bp->dev, "vf ndo called though sriov is disabled\n"); + return -EINVAL; + } +- if (vf_id >= bp->pf.max_vfs) { ++ if (vf_id >= bp->pf.active_vfs) { + netdev_err(bp->dev, "Invalid VF id %d\n", vf_id); + return -EINVAL; + } diff --git a/queue-4.9/can-flex_can-correct-the-checking-for-frame-length-in-flexcan_start_xmit.patch b/queue-4.9/can-flex_can-correct-the-checking-for-frame-length-in-flexcan_start_xmit.patch new file mode 100644 index 00000000000..89f8b12a82a --- /dev/null +++ b/queue-4.9/can-flex_can-correct-the-checking-for-frame-length-in-flexcan_start_xmit.patch @@ -0,0 +1,38 @@ +From foo@baz Wed Feb 28 16:13:29 CET 2018 +From: Luu An Phu +Date: Tue, 2 Jan 2018 10:44:18 +0700 +Subject: can: flex_can: Correct the checking for frame length in flexcan_start_xmit() + +From: Luu An Phu + + +[ Upstream commit 13454c14550065fcc1705d6bd4ee6d40e057099f ] + +The flexcan_start_xmit() function compares the frame length with data +register length to write frame content into data[0] and data[1] +register. Data register length is 4 bytes and frame maximum length is 8 +bytes. + +Fix the check that compares frame length with 3. Because the register +length is 4. + +Signed-off-by: Luu An Phu +Reviewed-by: Oliver Hartkopp +Signed-off-by: Marc Kleine-Budde +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/can/flexcan.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/can/flexcan.c ++++ b/drivers/net/can/flexcan.c +@@ -493,7 +493,7 @@ static int flexcan_start_xmit(struct sk_ + data = be32_to_cpup((__be32 *)&cf->data[0]); + flexcan_write(data, ®s->mb[FLEXCAN_TX_BUF_ID].data[0]); + } +- if (cf->can_dlc > 3) { ++ if (cf->can_dlc > 4) { + data = be32_to_cpup((__be32 *)&cf->data[4]); + flexcan_write(data, ®s->mb[FLEXCAN_TX_BUF_ID].data[1]); + } diff --git a/queue-4.9/dmaengine-fsl-edma-disable-clks-on-all-error-paths.patch b/queue-4.9/dmaengine-fsl-edma-disable-clks-on-all-error-paths.patch new file mode 100644 index 00000000000..2d66527c228 --- /dev/null +++ b/queue-4.9/dmaengine-fsl-edma-disable-clks-on-all-error-paths.patch @@ -0,0 +1,111 @@ +From foo@baz Wed Feb 28 16:13:29 CET 2018 +From: Andreas Platschek +Date: Thu, 14 Dec 2017 12:50:51 +0100 +Subject: dmaengine: fsl-edma: disable clks on all error paths + +From: Andreas Platschek + + +[ Upstream commit 2610acf46b9ed528ec2cacd717bc9d354e452b73 ] + +Previously enabled clks are only disabled if clk_prepare_enable() fails. +However, there are other error paths were the previously enabled +clocks are not disabled. + +To fix the problem, fsl_disable_clocks() now takes the number of clocks +that shall be disabled + unprepared. For existing calls were all clocks +were already successfully prepared + enabled, DMAMUX_NR is passed to +disable + unprepare all clocks. + +In error paths were only some clocks were successfully prepared + +enabled the loop counter is passed, in order to disable + unprepare +all successfully prepared + enabled clocks. + +Found by Linux Driver Verification project (linuxtesting.org). + +Signed-off-by: Andreas Platschek +Signed-off-by: Vinod Koul +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/dma/fsl-edma.c | 28 ++++++++++++++-------------- + 1 file changed, 14 insertions(+), 14 deletions(-) + +--- a/drivers/dma/fsl-edma.c ++++ b/drivers/dma/fsl-edma.c +@@ -863,11 +863,11 @@ static void fsl_edma_irq_exit( + } + } + +-static void fsl_disable_clocks(struct fsl_edma_engine *fsl_edma) ++static void fsl_disable_clocks(struct fsl_edma_engine *fsl_edma, int nr_clocks) + { + int i; + +- for (i = 0; i < DMAMUX_NR; i++) ++ for (i = 0; i < nr_clocks; i++) + clk_disable_unprepare(fsl_edma->muxclk[i]); + } + +@@ -904,25 +904,25 @@ static int fsl_edma_probe(struct platfor + + res = platform_get_resource(pdev, IORESOURCE_MEM, 1 + i); + fsl_edma->muxbase[i] = devm_ioremap_resource(&pdev->dev, res); +- if (IS_ERR(fsl_edma->muxbase[i])) ++ if (IS_ERR(fsl_edma->muxbase[i])) { ++ /* on error: disable all previously enabled clks */ ++ fsl_disable_clocks(fsl_edma, i); + return PTR_ERR(fsl_edma->muxbase[i]); ++ } + + sprintf(clkname, "dmamux%d", i); + fsl_edma->muxclk[i] = devm_clk_get(&pdev->dev, clkname); + if (IS_ERR(fsl_edma->muxclk[i])) { + dev_err(&pdev->dev, "Missing DMAMUX block clock.\n"); ++ /* on error: disable all previously enabled clks */ ++ fsl_disable_clocks(fsl_edma, i); + return PTR_ERR(fsl_edma->muxclk[i]); + } + + ret = clk_prepare_enable(fsl_edma->muxclk[i]); +- if (ret) { +- /* disable only clks which were enabled on error */ +- for (; i >= 0; i--) +- clk_disable_unprepare(fsl_edma->muxclk[i]); +- +- dev_err(&pdev->dev, "DMAMUX clk block failed.\n"); +- return ret; +- } ++ if (ret) ++ /* on error: disable all previously enabled clks */ ++ fsl_disable_clocks(fsl_edma, i); + + } + +@@ -976,7 +976,7 @@ static int fsl_edma_probe(struct platfor + if (ret) { + dev_err(&pdev->dev, + "Can't register Freescale eDMA engine. (%d)\n", ret); +- fsl_disable_clocks(fsl_edma); ++ fsl_disable_clocks(fsl_edma, DMAMUX_NR); + return ret; + } + +@@ -985,7 +985,7 @@ static int fsl_edma_probe(struct platfor + dev_err(&pdev->dev, + "Can't register Freescale eDMA of_dma. (%d)\n", ret); + dma_async_device_unregister(&fsl_edma->dma_dev); +- fsl_disable_clocks(fsl_edma); ++ fsl_disable_clocks(fsl_edma, DMAMUX_NR); + return ret; + } + +@@ -1015,7 +1015,7 @@ static int fsl_edma_remove(struct platfo + fsl_edma_cleanup_vchan(&fsl_edma->dma_dev); + of_dma_controller_free(np); + dma_async_device_unregister(&fsl_edma->dma_dev); +- fsl_disable_clocks(fsl_edma); ++ fsl_disable_clocks(fsl_edma, DMAMUX_NR); + + return 0; + } diff --git a/queue-4.9/drm-nouveau-pci-do-a-msi-rearm-on-init.patch b/queue-4.9/drm-nouveau-pci-do-a-msi-rearm-on-init.patch new file mode 100644 index 00000000000..7e03ed3fb67 --- /dev/null +++ b/queue-4.9/drm-nouveau-pci-do-a-msi-rearm-on-init.patch @@ -0,0 +1,41 @@ +From foo@baz Wed Feb 28 16:13:29 CET 2018 +From: Karol Herbst +Date: Fri, 24 Nov 2017 03:56:26 +0100 +Subject: drm/nouveau/pci: do a msi rearm on init + +From: Karol Herbst + + +[ Upstream commit a121027d2747168df0aac0c3da35509eea39f61c ] + +On my GP107 when I load nouveau after unloading it, for some reason the +GPU stopped sending or the CPU stopped receiving interrupts if MSI was +enabled. + +Doing a rearm once before getting any interrupts fixes this. + +Signed-off-by: Karol Herbst +Reviewed-by: Thierry Reding +Signed-off-by: Ben Skeggs +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/nouveau/nvkm/subdev/pci/base.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +--- a/drivers/gpu/drm/nouveau/nvkm/subdev/pci/base.c ++++ b/drivers/gpu/drm/nouveau/nvkm/subdev/pci/base.c +@@ -136,6 +136,13 @@ nvkm_pci_init(struct nvkm_subdev *subdev + return ret; + + pci->irq = pdev->irq; ++ ++ /* Ensure MSI interrupts are armed, for the case where there are ++ * already interrupts pending (for whatever reason) at load time. ++ */ ++ if (pci->msi) ++ pci->func->msi_rearm(pci); ++ + return ret; + } + diff --git a/queue-4.9/drm-ttm-check-the-return-value-of-kzalloc.patch b/queue-4.9/drm-ttm-check-the-return-value-of-kzalloc.patch new file mode 100644 index 00000000000..2dd4dd69315 --- /dev/null +++ b/queue-4.9/drm-ttm-check-the-return-value-of-kzalloc.patch @@ -0,0 +1,33 @@ +From foo@baz Wed Feb 28 16:13:29 CET 2018 +From: Xiongwei Song +Date: Tue, 2 Jan 2018 21:24:55 +0800 +Subject: drm/ttm: check the return value of kzalloc + +From: Xiongwei Song + + +[ Upstream commit 19d859a7205bc59ffc38303eb25ae394f61d21dc ] + +In the function ttm_page_alloc_init, kzalloc call is made for variable +_manager, we need to check its return value, it may return NULL. + +Signed-off-by: Xiongwei Song +Reviewed-by: Christian König +Signed-off-by: Alex Deucher +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/ttm/ttm_page_alloc.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/drivers/gpu/drm/ttm/ttm_page_alloc.c ++++ b/drivers/gpu/drm/ttm/ttm_page_alloc.c +@@ -818,6 +818,8 @@ int ttm_page_alloc_init(struct ttm_mem_g + pr_info("Initializing pool allocator\n"); + + _manager = kzalloc(sizeof(*_manager), GFP_KERNEL); ++ if (!_manager) ++ return -ENOMEM; + + ttm_page_pool_init_locked(&_manager->wc_pool, GFP_HIGHUSER, "wc"); + diff --git a/queue-4.9/e1000-fix-disabling-already-disabled-warning.patch b/queue-4.9/e1000-fix-disabling-already-disabled-warning.patch new file mode 100644 index 00000000000..10c970ab6d2 --- /dev/null +++ b/queue-4.9/e1000-fix-disabling-already-disabled-warning.patch @@ -0,0 +1,181 @@ +From foo@baz Wed Feb 28 16:13:29 CET 2018 +From: Tushar Dave +Date: Wed, 6 Dec 2017 02:26:29 +0530 +Subject: e1000: fix disabling already-disabled warning + +From: Tushar Dave + + +[ Upstream commit 0b76aae741abb9d16d2c0e67f8b1e766576f897d ] + +This patch adds check so that driver does not disable already +disabled device. + +[ 44.637743] advantechwdt: Unexpected close, not stopping watchdog! +[ 44.997548] input: ImExPS/2 Generic Explorer Mouse as /devices/platform/i8042/serio1/input/input6 +[ 45.013419] e1000 0000:00:03.0: disabling already-disabled device +[ 45.013447] ------------[ cut here ]------------ +[ 45.014868] WARNING: CPU: 1 PID: 71 at drivers/pci/pci.c:1641 pci_disable_device+0xa1/0x105: + pci_disable_device at drivers/pci/pci.c:1640 +[ 45.016171] CPU: 1 PID: 71 Comm: rcu_perf_shutdo Not tainted 4.14.0-01330-g3c07399 #1 +[ 45.017197] task: ffff88011bee9e40 task.stack: ffffc90000860000 +[ 45.017987] RIP: 0010:pci_disable_device+0xa1/0x105: + pci_disable_device at drivers/pci/pci.c:1640 +[ 45.018603] RSP: 0000:ffffc90000863e30 EFLAGS: 00010286 +[ 45.019282] RAX: 0000000000000035 RBX: ffff88013a230008 RCX: 0000000000000000 +[ 45.020182] RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000203 +[ 45.021084] RBP: ffff88013a3f31e8 R08: 0000000000000001 R09: 0000000000000000 +[ 45.021986] R10: ffffffff827ec29c R11: 0000000000000002 R12: 0000000000000001 +[ 45.022946] R13: ffff88013a230008 R14: ffff880117802b20 R15: ffffc90000863e8f +[ 45.023842] FS: 0000000000000000(0000) GS:ffff88013fd00000(0000) knlGS:0000000000000000 +[ 45.024863] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 +[ 45.025583] CR2: ffffc900006d4000 CR3: 000000000220f000 CR4: 00000000000006a0 +[ 45.026478] Call Trace: +[ 45.026811] __e1000_shutdown+0x1d4/0x1e2: + __e1000_shutdown at drivers/net/ethernet/intel/e1000/e1000_main.c:5162 +[ 45.027344] ? rcu_perf_cleanup+0x2a1/0x2a1: + rcu_perf_shutdown at kernel/rcu/rcuperf.c:627 +[ 45.027883] e1000_shutdown+0x14/0x3a: + e1000_shutdown at drivers/net/ethernet/intel/e1000/e1000_main.c:5235 +[ 45.028351] device_shutdown+0x110/0x1aa: + device_shutdown at drivers/base/core.c:2807 +[ 45.028858] kernel_power_off+0x31/0x64: + kernel_power_off at kernel/reboot.c:260 +[ 45.029343] rcu_perf_shutdown+0x9b/0xa7: + rcu_perf_shutdown at kernel/rcu/rcuperf.c:637 +[ 45.029852] ? __wake_up_common_lock+0xa2/0xa2: + autoremove_wake_function at kernel/sched/wait.c:376 +[ 45.030414] kthread+0x126/0x12e: + kthread at kernel/kthread.c:233 +[ 45.030834] ? __kthread_bind_mask+0x8e/0x8e: + kthread at kernel/kthread.c:190 +[ 45.031399] ? ret_from_fork+0x1f/0x30: + ret_from_fork at arch/x86/entry/entry_64.S:443 +[ 45.031883] ? kernel_init+0xa/0xf5: + kernel_init at init/main.c:997 +[ 45.032325] ret_from_fork+0x1f/0x30: + ret_from_fork at arch/x86/entry/entry_64.S:443 +[ 45.032777] Code: 00 48 85 ed 75 07 48 8b ab a8 00 00 00 48 8d bb 98 00 00 00 e8 aa d1 11 00 48 89 ea 48 89 c6 48 c7 c7 d8 e4 0b 82 e8 55 7d da ff <0f> ff b9 01 00 00 00 31 d2 be 01 00 00 00 48 c7 c7 f0 b1 61 82 +[ 45.035222] ---[ end trace c257137b1b1976ef ]--- +[ 45.037838] ACPI: Preparing to enter system sleep state S5 + +Signed-off-by: Tushar Dave +Tested-by: Fengguang Wu +Signed-off-by: Jeff Kirsher +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/ethernet/intel/e1000/e1000.h | 3 +- + drivers/net/ethernet/intel/e1000/e1000_main.c | 27 +++++++++++++++++++++----- + 2 files changed, 24 insertions(+), 6 deletions(-) + +--- a/drivers/net/ethernet/intel/e1000/e1000.h ++++ b/drivers/net/ethernet/intel/e1000/e1000.h +@@ -331,7 +331,8 @@ struct e1000_adapter { + enum e1000_state_t { + __E1000_TESTING, + __E1000_RESETTING, +- __E1000_DOWN ++ __E1000_DOWN, ++ __E1000_DISABLED + }; + + #undef pr_fmt +--- a/drivers/net/ethernet/intel/e1000/e1000_main.c ++++ b/drivers/net/ethernet/intel/e1000/e1000_main.c +@@ -940,7 +940,7 @@ static int e1000_init_hw_struct(struct e + static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent) + { + struct net_device *netdev; +- struct e1000_adapter *adapter; ++ struct e1000_adapter *adapter = NULL; + struct e1000_hw *hw; + + static int cards_found; +@@ -950,6 +950,7 @@ static int e1000_probe(struct pci_dev *p + u16 tmp = 0; + u16 eeprom_apme_mask = E1000_EEPROM_APME; + int bars, need_ioport; ++ bool disable_dev = false; + + /* do not allocate ioport bars when not needed */ + need_ioport = e1000_is_need_ioport(pdev); +@@ -1250,11 +1251,13 @@ err_mdio_ioremap: + iounmap(hw->ce4100_gbe_mdio_base_virt); + iounmap(hw->hw_addr); + err_ioremap: ++ disable_dev = !test_and_set_bit(__E1000_DISABLED, &adapter->flags); + free_netdev(netdev); + err_alloc_etherdev: + pci_release_selected_regions(pdev, bars); + err_pci_reg: +- pci_disable_device(pdev); ++ if (!adapter || disable_dev) ++ pci_disable_device(pdev); + return err; + } + +@@ -1272,6 +1275,7 @@ static void e1000_remove(struct pci_dev + struct net_device *netdev = pci_get_drvdata(pdev); + struct e1000_adapter *adapter = netdev_priv(netdev); + struct e1000_hw *hw = &adapter->hw; ++ bool disable_dev; + + e1000_down_and_stop(adapter); + e1000_release_manageability(adapter); +@@ -1290,9 +1294,11 @@ static void e1000_remove(struct pci_dev + iounmap(hw->flash_address); + pci_release_selected_regions(pdev, adapter->bars); + ++ disable_dev = !test_and_set_bit(__E1000_DISABLED, &adapter->flags); + free_netdev(netdev); + +- pci_disable_device(pdev); ++ if (disable_dev) ++ pci_disable_device(pdev); + } + + /** +@@ -5166,7 +5172,8 @@ static int __e1000_shutdown(struct pci_d + if (netif_running(netdev)) + e1000_free_irq(adapter); + +- pci_disable_device(pdev); ++ if (!test_and_set_bit(__E1000_DISABLED, &adapter->flags)) ++ pci_disable_device(pdev); + + return 0; + } +@@ -5210,6 +5217,10 @@ static int e1000_resume(struct pci_dev * + pr_err("Cannot enable PCI device from suspend\n"); + return err; + } ++ ++ /* flush memory to make sure state is correct */ ++ smp_mb__before_atomic(); ++ clear_bit(__E1000_DISABLED, &adapter->flags); + pci_set_master(pdev); + + pci_enable_wake(pdev, PCI_D3hot, 0); +@@ -5284,7 +5295,9 @@ static pci_ers_result_t e1000_io_error_d + + if (netif_running(netdev)) + e1000_down(adapter); +- pci_disable_device(pdev); ++ ++ if (!test_and_set_bit(__E1000_DISABLED, &adapter->flags)) ++ pci_disable_device(pdev); + + /* Request a slot slot reset. */ + return PCI_ERS_RESULT_NEED_RESET; +@@ -5312,6 +5325,10 @@ static pci_ers_result_t e1000_io_slot_re + pr_err("Cannot re-enable PCI device after reset.\n"); + return PCI_ERS_RESULT_DISCONNECT; + } ++ ++ /* flush memory to make sure state is correct */ ++ smp_mb__before_atomic(); ++ clear_bit(__E1000_DISABLED, &adapter->flags); + pci_set_master(pdev); + + pci_enable_wake(pdev, PCI_D3hot, 0); diff --git a/queue-4.9/genirq-guard-handle_bad_irq-log-messages.patch b/queue-4.9/genirq-guard-handle_bad_irq-log-messages.patch new file mode 100644 index 00000000000..c80d55d12f8 --- /dev/null +++ b/queue-4.9/genirq-guard-handle_bad_irq-log-messages.patch @@ -0,0 +1,60 @@ +From foo@baz Wed Feb 28 16:13:29 CET 2018 +From: Guenter Roeck +Date: Sat, 2 Dec 2017 09:13:04 -0800 +Subject: genirq: Guard handle_bad_irq log messages + +From: Guenter Roeck + + +[ Upstream commit 11bca0a83f83f6093d816295668e74ef24595944 ] + +An interrupt storm on a bad interrupt will cause the kernel +log to be clogged. + +[ 60.089234] ->handle_irq(): ffffffffbe2f803f, +[ 60.090455] 0xffffffffbf2af380 +[ 60.090510] handle_bad_irq+0x0/0x2e5 +[ 60.090522] ->irq_data.chip(): ffffffffbf2af380, +[ 60.090553] IRQ_NOPROBE set +[ 60.090584] ->handle_irq(): ffffffffbe2f803f, +[ 60.090590] handle_bad_irq+0x0/0x2e5 +[ 60.090596] ->irq_data.chip(): ffffffffbf2af380, +[ 60.090602] 0xffffffffbf2af380 +[ 60.090608] ->action(): (null) +[ 60.090779] handle_bad_irq+0x0/0x2e5 + +This was seen when running an upstream kernel on Acer Chromebook R11. The +system was unstable as result. + +Guard the log message with __printk_ratelimit to reduce the impact. This +won't prevent the interrupt storm from happening, but at least the system +remains stable. + +Signed-off-by: Guenter Roeck +Signed-off-by: Thomas Gleixner +Cc: Dmitry Torokhov +Cc: Joe Perches +Cc: Andy Shevchenko +Cc: Mika Westerberg +Link: https://bugzilla.kernel.org/show_bug.cgi?id=197953 +Link: https://lkml.kernel.org/r/1512234784-21038-1-git-send-email-linux@roeck-us.net +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + kernel/irq/debug.h | 5 +++++ + 1 file changed, 5 insertions(+) + +--- a/kernel/irq/debug.h ++++ b/kernel/irq/debug.h +@@ -11,6 +11,11 @@ + + static inline void print_irq_desc(unsigned int irq, struct irq_desc *desc) + { ++ static DEFINE_RATELIMIT_STATE(ratelimit, 5 * HZ, 5); ++ ++ if (!__ratelimit(&ratelimit)) ++ return; ++ + printk("irq %d, desc: %p, depth: %d, count: %d, unhandled: %d\n", + irq, desc, desc->depth, desc->irq_count, desc->irqs_unhandled); + printk("->handle_irq(): %p, ", desc->handle_irq); diff --git a/queue-4.9/i40e-i40evf-account-for-frags-split-over-multiple-descriptors-in-check-linearize.patch b/queue-4.9/i40e-i40evf-account-for-frags-split-over-multiple-descriptors-in-check-linearize.patch new file mode 100644 index 00000000000..97bc8de2048 --- /dev/null +++ b/queue-4.9/i40e-i40evf-account-for-frags-split-over-multiple-descriptors-in-check-linearize.patch @@ -0,0 +1,122 @@ +From foo@baz Wed Feb 28 16:13:29 CET 2018 +From: Alexander Duyck +Date: Fri, 8 Dec 2017 10:55:04 -0800 +Subject: i40e/i40evf: Account for frags split over multiple descriptors in check linearize + +From: Alexander Duyck + + +[ Upstream commit 248de22e638f10bd5bfc7624a357f940f66ba137 ] + +The original code for __i40e_chk_linearize didn't take into account the +fact that if a fragment is 16K in size or larger it has to be split over 2 +descriptors and the smaller of those 2 descriptors will be on the trailing +edge of the transmit. As a result we can get into situations where we didn't +catch requests that could result in a Tx hang. + +This patch takes care of that by subtracting the length of all but the +trailing edge of the stale fragment before we test for sum. By doing this +we can guarantee that we have all cases covered, including the case of a +fragment that spans multiple descriptors. We don't need to worry about +checking the inner portions of this since 12K is the maximum aligned DMA +size and that is larger than any MSS will ever be since the MTU limit for +jumbos is something on the order of 9K. + +Signed-off-by: Alexander Duyck +Tested-by: Andrew Bowers +Signed-off-by: Jeff Kirsher +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/ethernet/intel/i40e/i40e_txrx.c | 26 +++++++++++++++++++++++--- + drivers/net/ethernet/intel/i40evf/i40e_txrx.c | 26 +++++++++++++++++++++++--- + 2 files changed, 46 insertions(+), 6 deletions(-) + +--- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c ++++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c +@@ -2670,10 +2670,30 @@ bool __i40e_chk_linearize(struct sk_buff + /* Walk through fragments adding latest fragment, testing it, and + * then removing stale fragments from the sum. + */ +- stale = &skb_shinfo(skb)->frags[0]; +- for (;;) { ++ for (stale = &skb_shinfo(skb)->frags[0];; stale++) { ++ int stale_size = skb_frag_size(stale); ++ + sum += skb_frag_size(frag++); + ++ /* The stale fragment may present us with a smaller ++ * descriptor than the actual fragment size. To account ++ * for that we need to remove all the data on the front and ++ * figure out what the remainder would be in the last ++ * descriptor associated with the fragment. ++ */ ++ if (stale_size > I40E_MAX_DATA_PER_TXD) { ++ int align_pad = -(stale->page_offset) & ++ (I40E_MAX_READ_REQ_SIZE - 1); ++ ++ sum -= align_pad; ++ stale_size -= align_pad; ++ ++ do { ++ sum -= I40E_MAX_DATA_PER_TXD_ALIGNED; ++ stale_size -= I40E_MAX_DATA_PER_TXD_ALIGNED; ++ } while (stale_size > I40E_MAX_DATA_PER_TXD); ++ } ++ + /* if sum is negative we failed to make sufficient progress */ + if (sum < 0) + return true; +@@ -2681,7 +2701,7 @@ bool __i40e_chk_linearize(struct sk_buff + if (!nr_frags--) + break; + +- sum -= skb_frag_size(stale++); ++ sum -= stale_size; + } + + return false; +--- a/drivers/net/ethernet/intel/i40evf/i40e_txrx.c ++++ b/drivers/net/ethernet/intel/i40evf/i40e_txrx.c +@@ -1872,10 +1872,30 @@ bool __i40evf_chk_linearize(struct sk_bu + /* Walk through fragments adding latest fragment, testing it, and + * then removing stale fragments from the sum. + */ +- stale = &skb_shinfo(skb)->frags[0]; +- for (;;) { ++ for (stale = &skb_shinfo(skb)->frags[0];; stale++) { ++ int stale_size = skb_frag_size(stale); ++ + sum += skb_frag_size(frag++); + ++ /* The stale fragment may present us with a smaller ++ * descriptor than the actual fragment size. To account ++ * for that we need to remove all the data on the front and ++ * figure out what the remainder would be in the last ++ * descriptor associated with the fragment. ++ */ ++ if (stale_size > I40E_MAX_DATA_PER_TXD) { ++ int align_pad = -(stale->page_offset) & ++ (I40E_MAX_READ_REQ_SIZE - 1); ++ ++ sum -= align_pad; ++ stale_size -= align_pad; ++ ++ do { ++ sum -= I40E_MAX_DATA_PER_TXD_ALIGNED; ++ stale_size -= I40E_MAX_DATA_PER_TXD_ALIGNED; ++ } while (stale_size > I40E_MAX_DATA_PER_TXD); ++ } ++ + /* if sum is negative we failed to make sufficient progress */ + if (sum < 0) + return true; +@@ -1883,7 +1903,7 @@ bool __i40evf_chk_linearize(struct sk_bu + if (!nr_frags--) + break; + +- sum -= skb_frag_size(stale++); ++ sum -= stale_size; + } + + return false; diff --git a/queue-4.9/ib-ipoib-fix-race-condition-in-neigh-creation.patch b/queue-4.9/ib-ipoib-fix-race-condition-in-neigh-creation.patch new file mode 100644 index 00000000000..b2776cf0f7c --- /dev/null +++ b/queue-4.9/ib-ipoib-fix-race-condition-in-neigh-creation.patch @@ -0,0 +1,136 @@ +From foo@baz Wed Feb 28 16:13:29 CET 2018 +From: Erez Shitrit +Date: Sun, 31 Dec 2017 15:33:15 +0200 +Subject: IB/ipoib: Fix race condition in neigh creation + +From: Erez Shitrit + + +[ Upstream commit 16ba3defb8bd01a9464ba4820a487f5b196b455b ] + +When using enhanced mode for IPoIB, two threads may execute xmit in +parallel to two different TX queues while the target is the same. +In this case, both of them will add the same neighbor to the path's +neigh link list and we might see the following message: + + list_add double add: new=ffff88024767a348, prev=ffff88024767a348... + WARNING: lib/list_debug.c:31__list_add_valid+0x4e/0x70 + ipoib_start_xmit+0x477/0x680 [ib_ipoib] + dev_hard_start_xmit+0xb9/0x3e0 + sch_direct_xmit+0xf9/0x250 + __qdisc_run+0x176/0x5d0 + __dev_queue_xmit+0x1f5/0xb10 + __dev_queue_xmit+0x55/0xb10 + +Analysis: +Two SKB are scheduled to be transmitted from two cores. +In ipoib_start_xmit, both gets NULL when calling ipoib_neigh_get. +Two calls to neigh_add_path are made. One thread takes the spin-lock +and calls ipoib_neigh_alloc which creates the neigh structure, +then (after the __path_find) the neigh is added to the path's neigh +link list. When the second thread enters the critical section it also +calls ipoib_neigh_alloc but in this case it gets the already allocated +ipoib_neigh structure, which is already linked to the path's neigh +link list and adds it again to the list. Which beside of triggering +the list, it creates a loop in the linked list. This loop leads to +endless loop inside path_rec_completion. + +Solution: +Check list_empty(&neigh->list) before adding to the list. +Add a similar fix in "ipoib_multicast.c::ipoib_mcast_send" + +Fixes: b63b70d87741 ('IPoIB: Use a private hash table for path lookup in xmit path') +Signed-off-by: Erez Shitrit +Reviewed-by: Alex Vesker +Signed-off-by: Leon Romanovsky +Signed-off-by: Jason Gunthorpe +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/infiniband/ulp/ipoib/ipoib_main.c | 25 ++++++++++++++++++------- + drivers/infiniband/ulp/ipoib/ipoib_multicast.c | 5 ++++- + 2 files changed, 22 insertions(+), 8 deletions(-) + +--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c ++++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c +@@ -919,8 +919,8 @@ static int path_rec_start(struct net_dev + return 0; + } + +-static void neigh_add_path(struct sk_buff *skb, u8 *daddr, +- struct net_device *dev) ++static struct ipoib_neigh *neigh_add_path(struct sk_buff *skb, u8 *daddr, ++ struct net_device *dev) + { + struct ipoib_dev_priv *priv = netdev_priv(dev); + struct ipoib_path *path; +@@ -933,7 +933,15 @@ static void neigh_add_path(struct sk_buf + spin_unlock_irqrestore(&priv->lock, flags); + ++dev->stats.tx_dropped; + dev_kfree_skb_any(skb); +- return; ++ return NULL; ++ } ++ ++ /* To avoid race condition, make sure that the ++ * neigh will be added only once. ++ */ ++ if (unlikely(!list_empty(&neigh->list))) { ++ spin_unlock_irqrestore(&priv->lock, flags); ++ return neigh; + } + + path = __path_find(dev, daddr + 4); +@@ -971,7 +979,7 @@ static void neigh_add_path(struct sk_buf + spin_unlock_irqrestore(&priv->lock, flags); + ipoib_send(dev, skb, path->ah, IPOIB_QPN(daddr)); + ipoib_neigh_put(neigh); +- return; ++ return NULL; + } + } else { + neigh->ah = NULL; +@@ -988,7 +996,7 @@ static void neigh_add_path(struct sk_buf + + spin_unlock_irqrestore(&priv->lock, flags); + ipoib_neigh_put(neigh); +- return; ++ return NULL; + + err_path: + ipoib_neigh_free(neigh); +@@ -998,6 +1006,8 @@ err_drop: + + spin_unlock_irqrestore(&priv->lock, flags); + ipoib_neigh_put(neigh); ++ ++ return NULL; + } + + static void unicast_arp_send(struct sk_buff *skb, struct net_device *dev, +@@ -1103,8 +1113,9 @@ static int ipoib_start_xmit(struct sk_bu + case htons(ETH_P_TIPC): + neigh = ipoib_neigh_get(dev, phdr->hwaddr); + if (unlikely(!neigh)) { +- neigh_add_path(skb, phdr->hwaddr, dev); +- return NETDEV_TX_OK; ++ neigh = neigh_add_path(skb, phdr->hwaddr, dev); ++ if (likely(!neigh)) ++ return NETDEV_TX_OK; + } + break; + case htons(ETH_P_ARP): +--- a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c ++++ b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c +@@ -818,7 +818,10 @@ void ipoib_mcast_send(struct net_device + spin_lock_irqsave(&priv->lock, flags); + if (!neigh) { + neigh = ipoib_neigh_alloc(daddr, dev); +- if (neigh) { ++ /* Make sure that the neigh will be added only ++ * once to mcast list. ++ */ ++ if (neigh && list_empty(&neigh->list)) { + kref_get(&mcast->ah->ref); + neigh->ah = mcast->ah; + list_add_tail(&neigh->list, &mcast->neigh_list); diff --git a/queue-4.9/ib-mlx4-fix-mlx4_ib_alloc_mr-error-flow.patch b/queue-4.9/ib-mlx4-fix-mlx4_ib_alloc_mr-error-flow.patch new file mode 100644 index 00000000000..c036871697d --- /dev/null +++ b/queue-4.9/ib-mlx4-fix-mlx4_ib_alloc_mr-error-flow.patch @@ -0,0 +1,46 @@ +From foo@baz Wed Feb 28 16:13:29 CET 2018 +From: Leon Romanovsky +Date: Sun, 31 Dec 2017 15:33:14 +0200 +Subject: IB/mlx4: Fix mlx4_ib_alloc_mr error flow + +From: Leon Romanovsky + + +[ Upstream commit 5a371cf87e145b86efd32007e46146e78c1eff6d ] + +ibmr.device is being set only after ib_alloc_mr() is successfully complete. +Therefore, in case imlx4_mr_enable() returns with error, the error flow +unwinder calls to mlx4_free_priv_pages(), which uses ibmr.device. + +Such usage causes to NULL dereference oops and to fix it, the IB device +should be set in the mr struct earlier stage (e.g. prior to calling +mlx4_free_priv_pages()). + +Fixes: 1b2cd0fc673c ("IB/mlx4: Support the new memory registration API") +Signed-off-by: Nitzan Carmi +Signed-off-by: Leon Romanovsky +Signed-off-by: Jason Gunthorpe +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/infiniband/hw/mlx4/mr.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/infiniband/hw/mlx4/mr.c ++++ b/drivers/infiniband/hw/mlx4/mr.c +@@ -406,7 +406,6 @@ struct ib_mr *mlx4_ib_alloc_mr(struct ib + goto err_free_mr; + + mr->max_pages = max_num_sg; +- + err = mlx4_mr_enable(dev->dev, &mr->mmr); + if (err) + goto err_free_pl; +@@ -417,6 +416,7 @@ struct ib_mr *mlx4_ib_alloc_mr(struct ib + return &mr->ibmr; + + err_free_pl: ++ mr->ibmr.device = pd->device; + mlx4_free_priv_pages(mr); + err_free_mr: + (void) mlx4_mr_free(dev->dev, &mr->mmr); diff --git a/queue-4.9/ib-mlx5-fix-mlx5_ib_alloc_mr-error-flow.patch b/queue-4.9/ib-mlx5-fix-mlx5_ib_alloc_mr-error-flow.patch new file mode 100644 index 00000000000..7533eb2613f --- /dev/null +++ b/queue-4.9/ib-mlx5-fix-mlx5_ib_alloc_mr-error-flow.patch @@ -0,0 +1,40 @@ +From foo@baz Wed Feb 28 16:13:29 CET 2018 +From: Nitzan Carmi +Date: Tue, 26 Dec 2017 11:20:20 +0200 +Subject: IB/mlx5: Fix mlx5_ib_alloc_mr error flow + +From: Nitzan Carmi + + +[ Upstream commit 45e6ae7ef21b907dacb18da62d5787d74a31d860 ] + +ibmr.device is being set only after ib_alloc_mr() is +(successfully) complete. Therefore, in case mlx5_core_create_mkey() +return with error, the error flow calls mlx5_free_priv_descs() +which uses ibmr.device (which doesn't exist yet), causing +a NULL dereference oops. + +To fix this, the IB device should be set in the mr struct earlier +stage (e.g. prior to calling mlx5_core_create_mkey()). + +Fixes: 8a187ee52b04 ("IB/mlx5: Support the new memory registration API") +Signed-off-by: Max Gurtovoy +Signed-off-by: Nitzan Carmi +Signed-off-by: Leon Romanovsky +Signed-off-by: Jason Gunthorpe +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/infiniband/hw/mlx5/mr.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/infiniband/hw/mlx5/mr.c ++++ b/drivers/infiniband/hw/mlx5/mr.c +@@ -1648,6 +1648,7 @@ struct ib_mr *mlx5_ib_alloc_mr(struct ib + MLX5_SET(mkc, mkc, access_mode, mr->access_mode); + MLX5_SET(mkc, mkc, umr_en, 1); + ++ mr->ibmr.device = pd->device; + err = mlx5_core_create_mkey(dev->mdev, &mr->mmkey, in, inlen); + if (err) + goto err_destroy_psv; diff --git a/queue-4.9/ip6_tunnel-get-the-min-mtu-properly-in-ip6_tnl_xmit.patch b/queue-4.9/ip6_tunnel-get-the-min-mtu-properly-in-ip6_tnl_xmit.patch new file mode 100644 index 00000000000..dbb3c4e63c0 --- /dev/null +++ b/queue-4.9/ip6_tunnel-get-the-min-mtu-properly-in-ip6_tnl_xmit.patch @@ -0,0 +1,60 @@ +From foo@baz Wed Feb 28 16:13:29 CET 2018 +From: Xin Long +Date: Mon, 18 Dec 2017 14:26:21 +0800 +Subject: ip6_tunnel: get the min mtu properly in ip6_tnl_xmit + +From: Xin Long + + +[ Upstream commit c9fefa08190fc879fb2e681035d7774e0a8c5170 ] + +Now it's using IPV6_MIN_MTU as the min mtu in ip6_tnl_xmit, but +IPV6_MIN_MTU actually only works when the inner packet is ipv6. + +With IPV6_MIN_MTU for ipv4 packets, the new pmtu for inner dst +couldn't be set less than 1280. It would cause tx_err and the +packet to be dropped when the outer dst pmtu is close to 1280. + +Jianlin found it by running ipv4 traffic with the topo: + + (client) gre6 <---> eth1 (route) eth2 <---> gre6 (server) + +After changing eth2 mtu to 1300, the performance became very +low, or the connection was even broken. The issue also affects +ip4ip6 and ip6ip6 tunnels. + +So if the inner packet is ipv4, 576 should be considered as the +min mtu. + +Note that for ip4ip6 and ip6ip6 tunnels, the inner packet can +only be ipv4 or ipv6, but for gre6 tunnel, it may also be ARP. +This patch using 576 as the min mtu for non-ipv6 packet works +for all those cases. + +Reported-by: Jianlin Shi +Signed-off-by: Xin Long +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + net/ipv6/ip6_tunnel.c | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +--- a/net/ipv6/ip6_tunnel.c ++++ b/net/ipv6/ip6_tunnel.c +@@ -1127,8 +1127,13 @@ route_lookup: + max_headroom += 8; + mtu -= 8; + } +- if (mtu < IPV6_MIN_MTU) +- mtu = IPV6_MIN_MTU; ++ if (skb->protocol == htons(ETH_P_IPV6)) { ++ if (mtu < IPV6_MIN_MTU) ++ mtu = IPV6_MIN_MTU; ++ } else if (mtu < 576) { ++ mtu = 576; ++ } ++ + if (skb_dst(skb) && !t->parms.collect_md) + skb_dst(skb)->ops->update_pmtu(skb_dst(skb), NULL, skb, mtu); + if (skb->len - t->tun_hlen - eth_hlen > mtu && !skb_is_gso(skb)) { diff --git a/queue-4.9/ipv6-icmp6-allow-icmp-messages-to-be-looped-back.patch b/queue-4.9/ipv6-icmp6-allow-icmp-messages-to-be-looped-back.patch new file mode 100644 index 00000000000..6376d04e6c6 --- /dev/null +++ b/queue-4.9/ipv6-icmp6-allow-icmp-messages-to-be-looped-back.patch @@ -0,0 +1,44 @@ +From foo@baz Wed Feb 28 16:13:29 CET 2018 +From: Brendan McGrath +Date: Wed, 13 Dec 2017 22:14:57 +1100 +Subject: ipv6: icmp6: Allow icmp messages to be looped back + +From: Brendan McGrath + + +[ Upstream commit 588753f1eb18978512b1c9b85fddb457d46f9033 ] + +One example of when an ICMPv6 packet is required to be looped back is +when a host acts as both a Multicast Listener and a Multicast Router. + +A Multicast Router will listen on address ff02::16 for MLDv2 messages. + +Currently, MLDv2 messages originating from a Multicast Listener running +on the same host as the Multicast Router are not being delivered to the +Multicast Router. This is due to dst.input being assigned the default +value of dst_discard. + +This results in the packet being looped back but discarded before being +delivered to the Multicast Router. + +This patch sets dst.input to ip6_input to ensure a looped back packet +is delivered to the Multicast Router. + +Signed-off-by: Brendan McGrath +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + net/ipv6/route.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/net/ipv6/route.c ++++ b/net/ipv6/route.c +@@ -1651,6 +1651,7 @@ struct dst_entry *icmp6_dst_alloc(struct + } + + rt->dst.flags |= DST_HOST; ++ rt->dst.input = ip6_input; + rt->dst.output = ip6_output; + atomic_set(&rt->dst.__refcnt, 1); + rt->rt6i_gateway = fl6->daddr; diff --git a/queue-4.9/led-core-fix-brightness-setting-when-setting-delay_off-0.patch b/queue-4.9/led-core-fix-brightness-setting-when-setting-delay_off-0.patch new file mode 100644 index 00000000000..a53f713a42b --- /dev/null +++ b/queue-4.9/led-core-fix-brightness-setting-when-setting-delay_off-0.patch @@ -0,0 +1,32 @@ +From foo@baz Wed Feb 28 16:13:29 CET 2018 +From: Matthieu CASTET +Date: Tue, 12 Dec 2017 11:10:44 +0100 +Subject: led: core: Fix brightness setting when setting delay_off=0 + +From: Matthieu CASTET + + +[ Upstream commit 2b83ff96f51d0b039c4561b9f95c824d7bddb85c ] + +With the current code, the following sequence won't work : +echo timer > trigger + +echo 0 > delay_off +* at this point we call +** led_delay_off_store +** led_blink_set +--- + drivers/leds/led-core.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/leds/led-core.c ++++ b/drivers/leds/led-core.c +@@ -186,7 +186,7 @@ void led_blink_set(struct led_classdev * + unsigned long *delay_on, + unsigned long *delay_off) + { +- del_timer_sync(&led_cdev->blink_timer); ++ led_stop_software_blink(led_cdev); + + led_cdev->flags &= ~LED_BLINK_ONESHOT; + led_cdev->flags &= ~LED_BLINK_ONESHOT_STOP; diff --git a/queue-4.9/lib-mpi-fix-umul_ppmm-for-mips64r6.patch b/queue-4.9/lib-mpi-fix-umul_ppmm-for-mips64r6.patch new file mode 100644 index 00000000000..4b72e5bb306 --- /dev/null +++ b/queue-4.9/lib-mpi-fix-umul_ppmm-for-mips64r6.patch @@ -0,0 +1,78 @@ +From foo@baz Wed Feb 28 16:13:29 CET 2018 +From: James Hogan +Date: Tue, 5 Dec 2017 23:31:35 +0000 +Subject: lib/mpi: Fix umul_ppmm() for MIPS64r6 + +From: James Hogan + + +[ Upstream commit bbc25bee37d2b32cf3a1fab9195b6da3a185614a ] + +Current MIPS64r6 toolchains aren't able to generate efficient +DMULU/DMUHU based code for the C implementation of umul_ppmm(), which +performs an unsigned 64 x 64 bit multiply and returns the upper and +lower 64-bit halves of the 128-bit result. Instead it widens the 64-bit +inputs to 128-bits and emits a __multi3 intrinsic call to perform a 128 +x 128 multiply. This is both inefficient, and it results in a link error +since we don't include __multi3 in MIPS linux. + +For example commit 90a53e4432b1 ("cfg80211: implement regdb signature +checking") merged in v4.15-rc1 recently broke the 64r6_defconfig and +64r6el_defconfig builds by indirectly selecting MPILIB. The same build +errors can be reproduced on older kernels by enabling e.g. CRYPTO_RSA: + +lib/mpi/generic_mpih-mul1.o: In function `mpihelp_mul_1': +lib/mpi/generic_mpih-mul1.c:50: undefined reference to `__multi3' +lib/mpi/generic_mpih-mul2.o: In function `mpihelp_addmul_1': +lib/mpi/generic_mpih-mul2.c:49: undefined reference to `__multi3' +lib/mpi/generic_mpih-mul3.o: In function `mpihelp_submul_1': +lib/mpi/generic_mpih-mul3.c:49: undefined reference to `__multi3' +lib/mpi/mpih-div.o In function `mpihelp_divrem': +lib/mpi/mpih-div.c:205: undefined reference to `__multi3' +lib/mpi/mpih-div.c:142: undefined reference to `__multi3' + +Therefore add an efficient MIPS64r6 implementation of umul_ppmm() using +inline assembly and the DMULU/DMUHU instructions, to prevent __multi3 +calls being emitted. + +Fixes: 7fd08ca58ae6 ("MIPS: Add build support for the MIPS R6 ISA") +Signed-off-by: James Hogan +Cc: Ralf Baechle +Cc: Herbert Xu +Cc: "David S. Miller" +Cc: linux-mips@linux-mips.org +Cc: linux-crypto@vger.kernel.org +Signed-off-by: Herbert Xu +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + lib/mpi/longlong.h | 18 +++++++++++++++++- + 1 file changed, 17 insertions(+), 1 deletion(-) + +--- a/lib/mpi/longlong.h ++++ b/lib/mpi/longlong.h +@@ -671,7 +671,23 @@ do { \ + ************** MIPS/64 ************** + ***************************************/ + #if (defined(__mips) && __mips >= 3) && W_TYPE_SIZE == 64 +-#if (__GNUC__ >= 5) || (__GNUC__ >= 4 && __GNUC_MINOR__ >= 4) ++#if defined(__mips_isa_rev) && __mips_isa_rev >= 6 ++/* ++ * GCC ends up emitting a __multi3 intrinsic call for MIPS64r6 with the plain C ++ * code below, so we special case MIPS64r6 until the compiler can do better. ++ */ ++#define umul_ppmm(w1, w0, u, v) \ ++do { \ ++ __asm__ ("dmulu %0,%1,%2" \ ++ : "=d" ((UDItype)(w0)) \ ++ : "d" ((UDItype)(u)), \ ++ "d" ((UDItype)(v))); \ ++ __asm__ ("dmuhu %0,%1,%2" \ ++ : "=d" ((UDItype)(w1)) \ ++ : "d" ((UDItype)(u)), \ ++ "d" ((UDItype)(v))); \ ++} while (0) ++#elif (__GNUC__ >= 5) || (__GNUC__ >= 4 && __GNUC_MINOR__ >= 4) + #define umul_ppmm(w1, w0, u, v) \ + do { \ + typedef unsigned int __ll_UTItype __attribute__((mode(TI))); \ diff --git a/queue-4.9/mac80211-mesh-drop-frames-appearing-to-be-from-us.patch b/queue-4.9/mac80211-mesh-drop-frames-appearing-to-be-from-us.patch new file mode 100644 index 00000000000..0b7648ad1af --- /dev/null +++ b/queue-4.9/mac80211-mesh-drop-frames-appearing-to-be-from-us.patch @@ -0,0 +1,35 @@ +From foo@baz Wed Feb 28 16:13:29 CET 2018 +From: Johannes Berg +Date: Thu, 4 Jan 2018 15:51:53 +0100 +Subject: mac80211: mesh: drop frames appearing to be from us + +From: Johannes Berg + + +[ Upstream commit 736a80bbfda709fb3631f5f62056f250a38e5804 ] + +If there are multiple mesh stations with the same MAC address, +they will both get confused and start throwing warnings. + +Obviously in this case nothing can actually work anyway, so just +drop frames that look like they're from ourselves early on. + +Reported-by: Gui Iribarren +Signed-off-by: Johannes Berg +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + net/mac80211/rx.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/net/mac80211/rx.c ++++ b/net/mac80211/rx.c +@@ -3611,6 +3611,8 @@ static bool ieee80211_accept_frame(struc + } + return true; + case NL80211_IFTYPE_MESH_POINT: ++ if (ether_addr_equal(sdata->vif.addr, hdr->addr2)) ++ return false; + if (multicast) + return true; + return ether_addr_equal(sdata->vif.addr, hdr->addr1); diff --git a/queue-4.9/mac80211_hwsim-fix-a-possible-sleep-in-atomic-bug-in-hwsim_get_radio_nl.patch b/queue-4.9/mac80211_hwsim-fix-a-possible-sleep-in-atomic-bug-in-hwsim_get_radio_nl.patch new file mode 100644 index 00000000000..17ab4b1a102 --- /dev/null +++ b/queue-4.9/mac80211_hwsim-fix-a-possible-sleep-in-atomic-bug-in-hwsim_get_radio_nl.patch @@ -0,0 +1,38 @@ +From foo@baz Wed Feb 28 16:13:29 CET 2018 +From: Jia-Ju Bai +Date: Tue, 12 Dec 2017 17:26:36 +0800 +Subject: mac80211_hwsim: Fix a possible sleep-in-atomic bug in hwsim_get_radio_nl + +From: Jia-Ju Bai + + +[ Upstream commit 162bd5e5fd921785077b5862d8f2ffabe2fe11e5 ] + +The driver may sleep under a spinlock. +The function call path is: +hwsim_get_radio_nl (acquire the spinlock) + nlmsg_new(GFP_KERNEL) --> may sleep + +To fix it, GFP_KERNEL is replaced with GFP_ATOMIC. + +This bug is found by my static analysis tool(DSAC) and checked by my code review. + +Signed-off-by: Jia-Ju Bai +Signed-off-by: Johannes Berg +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/wireless/mac80211_hwsim.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/wireless/mac80211_hwsim.c ++++ b/drivers/net/wireless/mac80211_hwsim.c +@@ -3154,7 +3154,7 @@ static int hwsim_get_radio_nl(struct sk_ + if (!net_eq(wiphy_net(data->hw->wiphy), genl_info_net(info))) + continue; + +- skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); ++ skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_ATOMIC); + if (!skb) { + res = -ENOMEM; + goto out_err; diff --git a/queue-4.9/macvlan-fix-one-possible-double-free.patch b/queue-4.9/macvlan-fix-one-possible-double-free.patch new file mode 100644 index 00000000000..0363744d660 --- /dev/null +++ b/queue-4.9/macvlan-fix-one-possible-double-free.patch @@ -0,0 +1,42 @@ +From foo@baz Wed Feb 28 16:13:29 CET 2018 +From: Gao Feng +Date: Tue, 26 Dec 2017 21:44:32 +0800 +Subject: macvlan: Fix one possible double free + +From: Gao Feng + + +[ Upstream commit d02fd6e7d2933ede6478a15f9e4ce8a93845824e ] + +Because the macvlan_uninit would free the macvlan port, so there is one +double free case in macvlan_common_newlink. When the macvlan port is just +created, then register_netdevice or netdev_upper_dev_link failed and they +would invoke macvlan_uninit. Then it would reach the macvlan_port_destroy +which triggers the double free. + +Signed-off-by: Gao Feng +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/macvlan.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +--- a/drivers/net/macvlan.c ++++ b/drivers/net/macvlan.c +@@ -1377,9 +1377,14 @@ int macvlan_common_newlink(struct net *s + return 0; + + unregister_netdev: ++ /* macvlan_uninit would free the macvlan port */ + unregister_netdevice(dev); ++ return err; + destroy_macvlan_port: +- if (create) ++ /* the macvlan port may be freed by macvlan_uninit when fail to register. ++ * so we destroy the macvlan port only when it's valid. ++ */ ++ if (create && macvlan_port_get_rtnl(dev)) + macvlan_port_destroy(port->dev); + return err; + } diff --git a/queue-4.9/mdio-sun4i-fix-a-memory-leak.patch b/queue-4.9/mdio-sun4i-fix-a-memory-leak.patch new file mode 100644 index 00000000000..3fd88cc762b --- /dev/null +++ b/queue-4.9/mdio-sun4i-fix-a-memory-leak.patch @@ -0,0 +1,39 @@ +From foo@baz Wed Feb 28 16:13:29 CET 2018 +From: Christophe JAILLET +Date: Sat, 6 Jan 2018 09:00:09 +0100 +Subject: mdio-sun4i: Fix a memory leak + +From: Christophe JAILLET + + +[ Upstream commit 56c0290202ab94a2f2780c449395d4ae8495fab4 ] + +If the probing of the regulator is deferred, the memory allocated by +'mdiobus_alloc_size()' will be leaking. +It should be freed before the next call to 'sun4i_mdio_probe()' which will +reallocate it. + +Fixes: 4bdcb1dd9feb ("net: Add MDIO bus driver for the Allwinner EMAC") +Signed-off-by: Christophe JAILLET +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/phy/mdio-sun4i.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +--- a/drivers/net/phy/mdio-sun4i.c ++++ b/drivers/net/phy/mdio-sun4i.c +@@ -118,8 +118,10 @@ static int sun4i_mdio_probe(struct platf + + data->regulator = devm_regulator_get(&pdev->dev, "phy"); + if (IS_ERR(data->regulator)) { +- if (PTR_ERR(data->regulator) == -EPROBE_DEFER) +- return -EPROBE_DEFER; ++ if (PTR_ERR(data->regulator) == -EPROBE_DEFER) { ++ ret = -EPROBE_DEFER; ++ goto err_out_free_mdiobus; ++ } + + dev_info(&pdev->dev, "no regulator found\n"); + data->regulator = NULL; diff --git a/queue-4.9/mtd-nand-brcmnand-zero-bitflip-is-not-an-error.patch b/queue-4.9/mtd-nand-brcmnand-zero-bitflip-is-not-an-error.patch new file mode 100644 index 00000000000..84f5f1941e7 --- /dev/null +++ b/queue-4.9/mtd-nand-brcmnand-zero-bitflip-is-not-an-error.patch @@ -0,0 +1,37 @@ +From foo@baz Wed Feb 28 16:13:29 CET 2018 +From: Albert Hsieh +Date: Mon, 20 Nov 2017 11:26:26 +0800 +Subject: mtd: nand: brcmnand: Zero bitflip is not an error + +From: Albert Hsieh + + +[ Upstream commit e44b9a9c135727f3410e029910275f40681dc8bc ] + +A negative return value of brcmstb_nand_verify_erased_page() indicates a +real bitflip error of an erased page, and other return values (>= 0) show +the corrected bitflip number. Zero return value means no bitflip, but the +current driver code treats it as an error, and eventually leads to +falsely reported ECC error. + +Fixes: 02b88eea9f9c ("mtd: brcmnand: Add check for erased page bitflip") +Signed-off-by: Albert Hsieh +Acked-by: Boris Brezillon +Signed-off-by: Richard Weinberger +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/mtd/nand/brcmnand/brcmnand.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/mtd/nand/brcmnand/brcmnand.c ++++ b/drivers/mtd/nand/brcmnand/brcmnand.c +@@ -1763,7 +1763,7 @@ try_dmaread: + err = brcmstb_nand_verify_erased_page(mtd, chip, buf, + addr); + /* erased page bitflips corrected */ +- if (err > 0) ++ if (err >= 0) + return err; + } + diff --git a/queue-4.9/mtd-nand-gpmi-fix-failure-when-a-erased-page-has-a-bitflip-at-bbm.patch b/queue-4.9/mtd-nand-gpmi-fix-failure-when-a-erased-page-has-a-bitflip-at-bbm.patch new file mode 100644 index 00000000000..d7ad3ca0cce --- /dev/null +++ b/queue-4.9/mtd-nand-gpmi-fix-failure-when-a-erased-page-has-a-bitflip-at-bbm.patch @@ -0,0 +1,63 @@ +From foo@baz Wed Feb 28 16:13:29 CET 2018 +From: Sascha Hauer +Date: Tue, 5 Dec 2017 11:51:40 +0100 +Subject: mtd: nand: gpmi: Fix failure when a erased page has a bitflip at BBM + +From: Sascha Hauer + + +[ Upstream commit fdf2e821052958a114618a95ab18a300d0b080cb ] + +When erased subpages are read then the BCH decoder returns STATUS_ERASED +if they are all empty, or STATUS_UNCORRECTABLE if there are bitflips. +When there are bitflips, we have to set these bits again to show the +upper layers a completely erased page. When a bitflip happens in the +exact byte where the bad block marker is, then this byte is swapped +with another byte in block_mark_swapping(). The correction code then +detects a bitflip in another subpage and no longer corrects the bitflip +where it really happens. + +Correct this behaviour by calling block_mark_swapping() after the +bitflips have been corrected. + +In our case UBIFS failed with this bug because it expects erased +pages to be really empty: + +UBIFS error (pid 187): ubifs_scan: corrupt empty space at LEB 36:118735 +UBIFS error (pid 187): ubifs_scanned_corruption: corruption at LEB 36:118735 +UBIFS error (pid 187): ubifs_scanned_corruption: first 8192 bytes from LEB 36:118735 +UBIFS error (pid 187): ubifs_scan: LEB 36 scanning failed +UBIFS error (pid 187): do_commit: commit failed, error -117 + +Signed-off-by: Sascha Hauer +Reviewed-by: Richard Weinberger +Acked-by: Boris Brezillon +Signed-off-by: Richard Weinberger +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/mtd/nand/gpmi-nand/gpmi-nand.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +--- a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c ++++ b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c +@@ -1059,9 +1059,6 @@ static int gpmi_ecc_read_page(struct mtd + return ret; + } + +- /* handle the block mark swapping */ +- block_mark_swapping(this, payload_virt, auxiliary_virt); +- + /* Loop over status bytes, accumulating ECC status. */ + status = auxiliary_virt + nfc_geo->auxiliary_status_offset; + +@@ -1150,6 +1147,9 @@ static int gpmi_ecc_read_page(struct mtd + max_bitflips = max_t(unsigned int, max_bitflips, *status); + } + ++ /* handle the block mark swapping */ ++ block_mark_swapping(this, buf, auxiliary_virt); ++ + if (oob_required) { + /* + * It's time to deliver the OOB bytes. See gpmi_ecc_read_oob() diff --git a/queue-4.9/net-arc_emac-fix-arc_emac_rx-error-paths.patch b/queue-4.9/net-arc_emac-fix-arc_emac_rx-error-paths.patch new file mode 100644 index 00000000000..0ac584525c1 --- /dev/null +++ b/queue-4.9/net-arc_emac-fix-arc_emac_rx-error-paths.patch @@ -0,0 +1,100 @@ +From foo@baz Wed Feb 28 16:13:29 CET 2018 +From: Alexander Kochetkov +Date: Fri, 15 Dec 2017 20:20:06 +0300 +Subject: net: arc_emac: fix arc_emac_rx() error paths + +From: Alexander Kochetkov + + +[ Upstream commit e688822d035b494071ecbadcccbd6f3325fb0f59 ] + +arc_emac_rx() has some issues found by code review. + +In case netdev_alloc_skb_ip_align() or dma_map_single() failure +rx fifo entry will not be returned to EMAC. + +In case dma_map_single() failure previously allocated skb became +lost to driver. At the same time address of newly allocated skb +will not be provided to EMAC. + +Signed-off-by: Alexander Kochetkov +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/ethernet/arc/emac_main.c | 53 ++++++++++++++++++++--------------- + 1 file changed, 31 insertions(+), 22 deletions(-) + +--- a/drivers/net/ethernet/arc/emac_main.c ++++ b/drivers/net/ethernet/arc/emac_main.c +@@ -210,39 +210,48 @@ static int arc_emac_rx(struct net_device + continue; + } + +- pktlen = info & LEN_MASK; +- stats->rx_packets++; +- stats->rx_bytes += pktlen; +- skb = rx_buff->skb; +- skb_put(skb, pktlen); +- skb->dev = ndev; +- skb->protocol = eth_type_trans(skb, ndev); +- +- dma_unmap_single(&ndev->dev, dma_unmap_addr(rx_buff, addr), +- dma_unmap_len(rx_buff, len), DMA_FROM_DEVICE); +- +- /* Prepare the BD for next cycle */ +- rx_buff->skb = netdev_alloc_skb_ip_align(ndev, +- EMAC_BUFFER_SIZE); +- if (unlikely(!rx_buff->skb)) { ++ /* Prepare the BD for next cycle. netif_receive_skb() ++ * only if new skb was allocated and mapped to avoid holes ++ * in the RX fifo. ++ */ ++ skb = netdev_alloc_skb_ip_align(ndev, EMAC_BUFFER_SIZE); ++ if (unlikely(!skb)) { ++ if (net_ratelimit()) ++ netdev_err(ndev, "cannot allocate skb\n"); ++ /* Return ownership to EMAC */ ++ rxbd->info = cpu_to_le32(FOR_EMAC | EMAC_BUFFER_SIZE); + stats->rx_errors++; +- /* Because receive_skb is below, increment rx_dropped */ + stats->rx_dropped++; + continue; + } + +- /* receive_skb only if new skb was allocated to avoid holes */ +- netif_receive_skb(skb); +- +- addr = dma_map_single(&ndev->dev, (void *)rx_buff->skb->data, ++ addr = dma_map_single(&ndev->dev, (void *)skb->data, + EMAC_BUFFER_SIZE, DMA_FROM_DEVICE); + if (dma_mapping_error(&ndev->dev, addr)) { + if (net_ratelimit()) +- netdev_err(ndev, "cannot dma map\n"); +- dev_kfree_skb(rx_buff->skb); ++ netdev_err(ndev, "cannot map dma buffer\n"); ++ dev_kfree_skb(skb); ++ /* Return ownership to EMAC */ ++ rxbd->info = cpu_to_le32(FOR_EMAC | EMAC_BUFFER_SIZE); + stats->rx_errors++; ++ stats->rx_dropped++; + continue; + } ++ ++ /* unmap previosly mapped skb */ ++ dma_unmap_single(&ndev->dev, dma_unmap_addr(rx_buff, addr), ++ dma_unmap_len(rx_buff, len), DMA_FROM_DEVICE); ++ ++ pktlen = info & LEN_MASK; ++ stats->rx_packets++; ++ stats->rx_bytes += pktlen; ++ skb_put(rx_buff->skb, pktlen); ++ rx_buff->skb->dev = ndev; ++ rx_buff->skb->protocol = eth_type_trans(rx_buff->skb, ndev); ++ ++ netif_receive_skb(rx_buff->skb); ++ ++ rx_buff->skb = skb; + dma_unmap_addr_set(rx_buff, addr, addr); + dma_unmap_len_set(rx_buff, len, EMAC_BUFFER_SIZE); + diff --git a/queue-4.9/net-gianfar_ptp-move-set_fipers-to-spinlock-protecting-area.patch b/queue-4.9/net-gianfar_ptp-move-set_fipers-to-spinlock-protecting-area.patch new file mode 100644 index 00000000000..99058bd100f --- /dev/null +++ b/queue-4.9/net-gianfar_ptp-move-set_fipers-to-spinlock-protecting-area.patch @@ -0,0 +1,40 @@ +From foo@baz Wed Feb 28 16:13:29 CET 2018 +From: Yangbo Lu +Date: Tue, 9 Jan 2018 11:02:33 +0800 +Subject: net: gianfar_ptp: move set_fipers() to spinlock protecting area + +From: Yangbo Lu + + +[ Upstream commit 11d827a993a969c3c6ec56758ff63a44ba19b466 ] + +set_fipers() calling should be protected by spinlock in +case that any interrupt breaks related registers setting +and the function we expect. This patch is to move set_fipers() +to spinlock protecting area in ptp_gianfar_adjtime(). + +Signed-off-by: Yangbo Lu +Acked-by: Richard Cochran +Reviewed-by: Fabio Estevam +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/ethernet/freescale/gianfar_ptp.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +--- a/drivers/net/ethernet/freescale/gianfar_ptp.c ++++ b/drivers/net/ethernet/freescale/gianfar_ptp.c +@@ -314,11 +314,10 @@ static int ptp_gianfar_adjtime(struct pt + now = tmr_cnt_read(etsects); + now += delta; + tmr_cnt_write(etsects, now); ++ set_fipers(etsects); + + spin_unlock_irqrestore(&etsects->lock, flags); + +- set_fipers(etsects); +- + return 0; + } + diff --git a/queue-4.9/net-mediatek-setup-proper-state-for-disabled-gmac-on-the-default.patch b/queue-4.9/net-mediatek-setup-proper-state-for-disabled-gmac-on-the-default.patch new file mode 100644 index 00000000000..b33d8d914c6 --- /dev/null +++ b/queue-4.9/net-mediatek-setup-proper-state-for-disabled-gmac-on-the-default.patch @@ -0,0 +1,46 @@ +From foo@baz Wed Feb 28 16:13:29 CET 2018 +From: Sean Wang +Date: Mon, 18 Dec 2017 17:00:17 +0800 +Subject: net: mediatek: setup proper state for disabled GMAC on the default + +From: Sean Wang + + +[ Upstream commit 7352e252b5bf40d59342494a70354a2d436fd0cd ] + +The current solution would setup fixed and force link of 1Gbps to the both +GMAC on the default. However, The GMAC should always be put to link down +state when the GMAC is disabled on certain target boards. Otherwise, +the driver possibly receives unexpected data from the floating hardware +connection through the unused GMAC. Although the driver had been added +certain protection in RX path to get rid of such kind of unexpected data +sent to the upper stack. + +Signed-off-by: Sean Wang +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/ethernet/mediatek/mtk_eth_soc.c | 11 ++++++----- + 1 file changed, 6 insertions(+), 5 deletions(-) + +--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c ++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c +@@ -1842,11 +1842,12 @@ static int mtk_hw_init(struct mtk_eth *e + /* set GE2 TUNE */ + regmap_write(eth->pctl, GPIO_BIAS_CTRL, 0x0); + +- /* GE1, Force 1000M/FD, FC ON */ +- mtk_w32(eth, MAC_MCR_FIXED_LINK, MTK_MAC_MCR(0)); +- +- /* GE2, Force 1000M/FD, FC ON */ +- mtk_w32(eth, MAC_MCR_FIXED_LINK, MTK_MAC_MCR(1)); ++ /* Set linkdown as the default for each GMAC. Its own MCR would be set ++ * up with the more appropriate value when mtk_phy_link_adjust call is ++ * being invoked. ++ */ ++ for (i = 0; i < MTK_MAC_COUNT; i++) ++ mtk_w32(eth, 0, MTK_MAC_MCR(i)); + + /* Enable RX VLan Offloading */ + mtk_w32(eth, 1, MTK_CDMP_EG_CTRL); diff --git a/queue-4.9/net-phy-xgene-disable-clk-on-error-paths.patch b/queue-4.9/net-phy-xgene-disable-clk-on-error-paths.patch new file mode 100644 index 00000000000..3d88ddcbfb4 --- /dev/null +++ b/queue-4.9/net-phy-xgene-disable-clk-on-error-paths.patch @@ -0,0 +1,83 @@ +From foo@baz Wed Feb 28 16:13:29 CET 2018 +From: Alexey Khoroshilov +Date: Sat, 16 Dec 2017 00:52:39 +0300 +Subject: net: phy: xgene: disable clk on error paths + +From: Alexey Khoroshilov + + +[ Upstream commit ab14436065c8066c265540312742390d6d07ddd2 ] + +There are several error paths in xgene_mdio_probe(), +where clk is left undisabled. The patch fixes them. + +Found by Linux Driver Verification project (linuxtesting.org). + +Signed-off-by: Alexey Khoroshilov +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/phy/mdio-xgene.c | 21 +++++++++++++++------ + 1 file changed, 15 insertions(+), 6 deletions(-) + +--- a/drivers/net/phy/mdio-xgene.c ++++ b/drivers/net/phy/mdio-xgene.c +@@ -197,8 +197,11 @@ static int xgene_mdio_reset(struct xgene + } + + ret = xgene_enet_ecc_init(pdata); +- if (ret) ++ if (ret) { ++ if (pdata->dev->of_node) ++ clk_disable_unprepare(pdata->clk); + return ret; ++ } + xgene_gmac_reset(pdata); + + return 0; +@@ -364,8 +367,10 @@ static int xgene_mdio_probe(struct platf + return ret; + + mdio_bus = mdiobus_alloc(); +- if (!mdio_bus) +- return -ENOMEM; ++ if (!mdio_bus) { ++ ret = -ENOMEM; ++ goto out_clk; ++ } + + mdio_bus->name = "APM X-Gene MDIO bus"; + +@@ -394,7 +399,7 @@ static int xgene_mdio_probe(struct platf + mdio_bus->phy_mask = ~0; + ret = mdiobus_register(mdio_bus); + if (ret) +- goto out; ++ goto out_mdiobus; + + acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_HANDLE(dev), 1, + acpi_register_phy, NULL, mdio_bus, NULL); +@@ -402,16 +407,20 @@ static int xgene_mdio_probe(struct platf + } + + if (ret) +- goto out; ++ goto out_mdiobus; + + pdata->mdio_bus = mdio_bus; + xgene_mdio_status = true; + + return 0; + +-out: ++out_mdiobus: + mdiobus_free(mdio_bus); + ++out_clk: ++ if (dev->of_node) ++ clk_disable_unprepare(pdata->clk); ++ + return ret; + } + diff --git a/queue-4.9/net-stmmac-fix-tx-timestamp-calculation.patch b/queue-4.9/net-stmmac-fix-tx-timestamp-calculation.patch new file mode 100644 index 00000000000..3b35d089bb9 --- /dev/null +++ b/queue-4.9/net-stmmac-fix-tx-timestamp-calculation.patch @@ -0,0 +1,46 @@ +From foo@baz Wed Feb 28 16:13:29 CET 2018 +From: Fredrik Hallenberg +Date: Mon, 18 Dec 2017 23:33:59 +0100 +Subject: net: stmmac: Fix TX timestamp calculation + +From: Fredrik Hallenberg + + +[ Upstream commit 200922c93f008e03ddc804c6dacdf26ca1ba86d7 ] + +When using GMAC4 the value written in PTP_SSIR should be shifted however +the shifted value is also used in subsequent calculations which results +in a bad timestamp value. + +Signed-off-by: Fredrik Hallenberg +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c ++++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c +@@ -38,6 +38,7 @@ static u32 stmmac_config_sub_second_incr + { + u32 value = readl(ioaddr + PTP_TCR); + unsigned long data; ++ u32 reg_value; + + /* For GMAC3.x, 4.x versions, convert the ptp_clock to nano second + * formula = (1/ptp_clock) * 1000000000 +@@ -54,10 +55,11 @@ static u32 stmmac_config_sub_second_incr + + data &= PTP_SSIR_SSINC_MASK; + ++ reg_value = data; + if (gmac4) +- data = data << GMAC4_PTP_SSIR_SSINC_SHIFT; ++ reg_value <<= GMAC4_PTP_SSIR_SSINC_SHIFT; + +- writel(data, ioaddr + PTP_SSIR); ++ writel(reg_value, ioaddr + PTP_SSIR); + + return data; + } diff --git a/queue-4.9/net-usb-qmi_wwan-add-support-for-yuga-clm920-nc5-pid-0x9625.patch b/queue-4.9/net-usb-qmi_wwan-add-support-for-yuga-clm920-nc5-pid-0x9625.patch new file mode 100644 index 00000000000..34805589565 --- /dev/null +++ b/queue-4.9/net-usb-qmi_wwan-add-support-for-yuga-clm920-nc5-pid-0x9625.patch @@ -0,0 +1,37 @@ +From foo@baz Wed Feb 28 16:13:29 CET 2018 +From: "SZ Lin (林上智)" +Date: Fri, 29 Dec 2017 17:02:17 +0800 +Subject: NET: usb: qmi_wwan: add support for YUGA CLM920-NC5 PID 0x9625 + +From: "SZ Lin (林上智)" + + +[ Upstream commit bd30ffc414e55194ed6149fad69a145550cb7c18 ] + +This patch adds support for PID 0x9625 of YUGA CLM920-NC5. + +YUGA CLM920-NC5 needs to enable QMI_WWAN_QUIRK_DTR before QMI operation. + +qmicli -d /dev/cdc-wdm0 -p --dms-get-revision +[/dev/cdc-wdm0] Device revision retrieved: + Revision: 'CLM920_NC5-V1 1 [Oct 23 2016 19:00:00]' + +Signed-off-by: SZ Lin (林上智) +Acked-by: Bjørn Mork +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/usb/qmi_wwan.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/net/usb/qmi_wwan.c ++++ b/drivers/net/usb/qmi_wwan.c +@@ -805,6 +805,7 @@ static const struct usb_device_id produc + {QMI_FIXED_INTF(0x05c6, 0x9084, 4)}, + {QMI_FIXED_INTF(0x05c6, 0x920d, 0)}, + {QMI_FIXED_INTF(0x05c6, 0x920d, 5)}, ++ {QMI_QUIRK_SET_DTR(0x05c6, 0x9625, 4)}, /* YUGA CLM920-NC5 */ + {QMI_FIXED_INTF(0x0846, 0x68a2, 8)}, + {QMI_FIXED_INTF(0x12d1, 0x140c, 1)}, /* Huawei E173 */ + {QMI_FIXED_INTF(0x12d1, 0x14ac, 1)}, /* Huawei E1820 */ diff --git a/queue-4.9/net-usb-qmi_wwan-add-telit-me910-pid-0x1101-support.patch b/queue-4.9/net-usb-qmi_wwan-add-telit-me910-pid-0x1101-support.patch new file mode 100644 index 00000000000..307947bd32c --- /dev/null +++ b/queue-4.9/net-usb-qmi_wwan-add-telit-me910-pid-0x1101-support.patch @@ -0,0 +1,31 @@ +From foo@baz Wed Feb 28 16:13:29 CET 2018 +From: Daniele Palmas +Date: Thu, 14 Dec 2017 16:56:14 +0100 +Subject: net: usb: qmi_wwan: add Telit ME910 PID 0x1101 support + +From: Daniele Palmas + + +[ Upstream commit c647c0d62c82eb3ddf78a0d8b3d58819d9f552aa ] + +This patch adds support for Telit ME910 PID 0x1101. + +Signed-off-by: Daniele Palmas +Acked-by: Bjørn Mork +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/usb/qmi_wwan.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/net/usb/qmi_wwan.c ++++ b/drivers/net/usb/qmi_wwan.c +@@ -914,6 +914,7 @@ static const struct usb_device_id produc + {QMI_FIXED_INTF(0x2357, 0x9000, 4)}, /* TP-LINK MA260 */ + {QMI_QUIRK_SET_DTR(0x1bc7, 0x1040, 2)}, /* Telit LE922A */ + {QMI_FIXED_INTF(0x1bc7, 0x1100, 3)}, /* Telit ME910 */ ++ {QMI_FIXED_INTF(0x1bc7, 0x1101, 3)}, /* Telit ME910 dual modem */ + {QMI_FIXED_INTF(0x1bc7, 0x1200, 5)}, /* Telit LE920 */ + {QMI_FIXED_INTF(0x1bc7, 0x1201, 2)}, /* Telit LE920 */ + {QMI_FIXED_INTF(0x1c9e, 0x9b01, 3)}, /* XS Stick W100-2 from 4G Systems */ diff --git a/queue-4.9/nl80211-check-for-the-required-netlink-attribute-presence.patch b/queue-4.9/nl80211-check-for-the-required-netlink-attribute-presence.patch new file mode 100644 index 00000000000..3ebcf647c6a --- /dev/null +++ b/queue-4.9/nl80211-check-for-the-required-netlink-attribute-presence.patch @@ -0,0 +1,36 @@ +From foo@baz Wed Feb 28 16:13:29 CET 2018 +From: Hao Chen +Date: Wed, 3 Jan 2018 11:00:31 +0800 +Subject: nl80211: Check for the required netlink attribute presence + +From: Hao Chen + + +[ Upstream commit 3ea15452ee85754f70f3b9fa1f23165ef2e77ba7 ] + +nl80211_nan_add_func() does not check if the required attribute +NL80211_NAN_FUNC_FOLLOW_UP_DEST is present when processing +NL80211_CMD_ADD_NAN_FUNCTION request. This request can be issued +by users with CAP_NET_ADMIN privilege and may result in NULL dereference +and a system crash. Add a check for the required attribute presence. + +Signed-off-by: Hao Chen +Signed-off-by: Johannes Berg +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + net/wireless/nl80211.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/net/wireless/nl80211.c ++++ b/net/wireless/nl80211.c +@@ -10777,7 +10777,8 @@ static int nl80211_nan_add_func(struct s + break; + case NL80211_NAN_FUNC_FOLLOW_UP: + if (!tb[NL80211_NAN_FUNC_FOLLOW_UP_ID] || +- !tb[NL80211_NAN_FUNC_FOLLOW_UP_REQ_ID]) { ++ !tb[NL80211_NAN_FUNC_FOLLOW_UP_REQ_ID] || ++ !tb[NL80211_NAN_FUNC_FOLLOW_UP_DEST]) { + err = -EINVAL; + goto out; + } diff --git a/queue-4.9/nvme-check-hw-sectors-before-setting-chunk-sectors.patch b/queue-4.9/nvme-check-hw-sectors-before-setting-chunk-sectors.patch new file mode 100644 index 00000000000..7d113f297e1 --- /dev/null +++ b/queue-4.9/nvme-check-hw-sectors-before-setting-chunk-sectors.patch @@ -0,0 +1,37 @@ +From foo@baz Wed Feb 28 16:13:29 CET 2018 +From: Keith Busch +Date: Thu, 14 Dec 2017 11:20:14 -0700 +Subject: nvme: check hw sectors before setting chunk sectors + +From: Keith Busch + + +[ Upstream commit 249159c5f15812140fa216f9997d799ac0023a1f ] + +Some devices with IDs matching the "stripe" quirk don't actually have +this quirk, and don't have an MDTS value. When MDTS is not set, the +driver sets the max sectors to UINT_MAX, which is not a power of 2, +hitting a BUG_ON from blk_queue_chunk_sectors. This patch skips setting +chunk sectors for such devices. + +Signed-off-by: Keith Busch +Reviewed-by: Martin K. Petersen +Signed-off-by: Christoph Hellwig +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvme/host/core.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/drivers/nvme/host/core.c ++++ b/drivers/nvme/host/core.c +@@ -1204,7 +1204,8 @@ static void nvme_set_queue_limits(struct + blk_queue_max_hw_sectors(q, ctrl->max_hw_sectors); + blk_queue_max_segments(q, min_t(u32, max_segments, USHRT_MAX)); + } +- if (ctrl->quirks & NVME_QUIRK_STRIPE_SIZE) ++ if ((ctrl->quirks & NVME_QUIRK_STRIPE_SIZE) && ++ is_power_of_2(ctrl->max_hw_sectors)) + blk_queue_chunk_sectors(q, ctrl->max_hw_sectors); + blk_queue_virt_boundary(q, ctrl->page_size - 1); + if (ctrl->vwc & NVME_CTRL_VWC_PRESENT) diff --git a/queue-4.9/s390-dasd-fix-wrongly-assigned-configuration-data.patch b/queue-4.9/s390-dasd-fix-wrongly-assigned-configuration-data.patch new file mode 100644 index 00000000000..170ceb99cef --- /dev/null +++ b/queue-4.9/s390-dasd-fix-wrongly-assigned-configuration-data.patch @@ -0,0 +1,49 @@ +From foo@baz Wed Feb 28 16:13:29 CET 2018 +From: Stefan Haberland +Date: Wed, 6 Dec 2017 10:30:39 +0100 +Subject: s390/dasd: fix wrongly assigned configuration data + +From: Stefan Haberland + + +[ Upstream commit 8a9bd4f8ebc6800bfc0596e28631ff6809a2f615 ] + +We store per path and per device configuration data to identify the +path or device correctly. The per path configuration data might get +mixed up if the original request gets into error recovery and is +started with a random path mask. + +This would lead to a wrong identification of a path in case of a CUIR +event for example. + +Fix by copying the path mask from the original request to the error +recovery request in case it is a path verification request. + +Signed-off-by: Stefan Haberland +Reviewed-by: Jan Hoeppner +Signed-off-by: Martin Schwidefsky +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/s390/block/dasd_3990_erp.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +--- a/drivers/s390/block/dasd_3990_erp.c ++++ b/drivers/s390/block/dasd_3990_erp.c +@@ -2755,6 +2755,16 @@ dasd_3990_erp_action(struct dasd_ccw_req + erp = dasd_3990_erp_handle_match_erp(cqr, erp); + } + ++ ++ /* ++ * For path verification work we need to stick with the path that was ++ * originally chosen so that the per path configuration data is ++ * assigned correctly. ++ */ ++ if (test_bit(DASD_CQR_VERIFY_PATH, &erp->flags) && cqr->lpm) { ++ erp->lpm = cqr->lpm; ++ } ++ + if (device->features & DASD_FEATURE_ERPLOG) { + /* print current erp_chain */ + dev_err(&device->cdev->dev, diff --git a/queue-4.9/scsi-storvsc-fix-scsi_cmd-error-assignments-in-storvsc_handle_error.patch b/queue-4.9/scsi-storvsc-fix-scsi_cmd-error-assignments-in-storvsc_handle_error.patch new file mode 100644 index 00000000000..e2024792ecb --- /dev/null +++ b/queue-4.9/scsi-storvsc-fix-scsi_cmd-error-assignments-in-storvsc_handle_error.patch @@ -0,0 +1,45 @@ +From foo@baz Wed Feb 28 16:13:29 CET 2018 +From: Cathy Avery +Date: Tue, 19 Dec 2017 13:32:48 -0500 +Subject: scsi: storvsc: Fix scsi_cmd error assignments in storvsc_handle_error + +From: Cathy Avery + + +[ Upstream commit d1b8b2391c24751e44f618fcf86fb55d9a9247fd ] + +When an I/O is returned with an srb_status of SRB_STATUS_INVALID_LUN +which has zero good_bytes it must be assigned an error. Otherwise the +I/O will be continuously requeued and will cause a deadlock in the case +where disks are being hot added and removed. sd_probe_async will wait +forever for its I/O to complete while holding scsi_sd_probe_domain. + +Also returning the default error of DID_TARGET_FAILURE causes multipath +to not retry the I/O resulting in applications receiving I/O errors +before a failover can occur. + +Signed-off-by: Cathy Avery +Signed-off-by: Long Li +Reviewed-by: Stephen Hemminger +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/scsi/storvsc_drv.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/drivers/scsi/storvsc_drv.c ++++ b/drivers/scsi/storvsc_drv.c +@@ -915,10 +915,11 @@ static void storvsc_handle_error(struct + case TEST_UNIT_READY: + break; + default: +- set_host_byte(scmnd, DID_TARGET_FAILURE); ++ set_host_byte(scmnd, DID_ERROR); + } + break; + case SRB_STATUS_INVALID_LUN: ++ set_host_byte(scmnd, DID_NO_CONNECT); + do_work = true; + process_err_fn = storvsc_remove_lun; + break; diff --git a/queue-4.9/sctp-make-use-of-pre-calculated-len.patch b/queue-4.9/sctp-make-use-of-pre-calculated-len.patch new file mode 100644 index 00000000000..cc08751f5db --- /dev/null +++ b/queue-4.9/sctp-make-use-of-pre-calculated-len.patch @@ -0,0 +1,94 @@ +From foo@baz Wed Feb 28 16:13:29 CET 2018 +From: Marcelo Ricardo Leitner +Date: Mon, 8 Jan 2018 19:02:29 -0200 +Subject: sctp: make use of pre-calculated len + +From: Marcelo Ricardo Leitner + + +[ Upstream commit c76f97c99ae6d26d14c7f0e50e074382bfbc9f98 ] + +Some sockopt handling functions were calculating the length of the +buffer to be written to userspace and then calculating it again when +actually writing the buffer, which could lead to some write not using +an up-to-date length. + +This patch updates such places to just make use of the len variable. + +Also, replace some sizeof(type) to sizeof(var). + +Signed-off-by: Marcelo Ricardo Leitner +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + net/sctp/socket.c | 16 ++++++++++------ + 1 file changed, 10 insertions(+), 6 deletions(-) + +--- a/net/sctp/socket.c ++++ b/net/sctp/socket.c +@@ -4765,7 +4765,7 @@ static int sctp_getsockopt_autoclose(str + len = sizeof(int); + if (put_user(len, optlen)) + return -EFAULT; +- if (copy_to_user(optval, &sctp_sk(sk)->autoclose, sizeof(int))) ++ if (copy_to_user(optval, &sctp_sk(sk)->autoclose, len)) + return -EFAULT; + return 0; + } +@@ -5342,6 +5342,9 @@ copy_getaddrs: + err = -EFAULT; + goto out; + } ++ /* XXX: We should have accounted for sizeof(struct sctp_getaddrs) too, ++ * but we can't change it anymore. ++ */ + if (put_user(bytes_copied, optlen)) + err = -EFAULT; + out: +@@ -5778,7 +5781,7 @@ static int sctp_getsockopt_maxseg(struct + params.assoc_id = 0; + } else if (len >= sizeof(struct sctp_assoc_value)) { + len = sizeof(struct sctp_assoc_value); +- if (copy_from_user(¶ms, optval, sizeof(params))) ++ if (copy_from_user(¶ms, optval, len)) + return -EFAULT; + } else + return -EINVAL; +@@ -5947,7 +5950,9 @@ static int sctp_getsockopt_active_key(st + + if (len < sizeof(struct sctp_authkeyid)) + return -EINVAL; +- if (copy_from_user(&val, optval, sizeof(struct sctp_authkeyid))) ++ ++ len = sizeof(struct sctp_authkeyid); ++ if (copy_from_user(&val, optval, len)) + return -EFAULT; + + asoc = sctp_id2assoc(sk, val.scact_assoc_id); +@@ -5959,7 +5964,6 @@ static int sctp_getsockopt_active_key(st + else + val.scact_keynumber = ep->active_key_id; + +- len = sizeof(struct sctp_authkeyid); + if (put_user(len, optlen)) + return -EFAULT; + if (copy_to_user(optval, &val, len)) +@@ -5985,7 +5989,7 @@ static int sctp_getsockopt_peer_auth_chu + if (len < sizeof(struct sctp_authchunks)) + return -EINVAL; + +- if (copy_from_user(&val, optval, sizeof(struct sctp_authchunks))) ++ if (copy_from_user(&val, optval, sizeof(val))) + return -EFAULT; + + to = p->gauth_chunks; +@@ -6030,7 +6034,7 @@ static int sctp_getsockopt_local_auth_ch + if (len < sizeof(struct sctp_authchunks)) + return -EINVAL; + +- if (copy_from_user(&val, optval, sizeof(struct sctp_authchunks))) ++ if (copy_from_user(&val, optval, sizeof(val))) + return -EFAULT; + + to = p->gauth_chunks; diff --git a/queue-4.9/series b/queue-4.9/series index 6e86da7ef7d..e3c88130b9d 100644 --- a/queue-4.9/series +++ b/queue-4.9/series @@ -1,3 +1,54 @@ hrtimer-ensure-posix-compliance-relative-clock_realtime-hrtimers.patch i2c-designware-must-wait-for-enable.patch f2fs-fix-a-bug-caused-by-null-extent-tree.patch +dmaengine-fsl-edma-disable-clks-on-all-error-paths.patch +nvme-check-hw-sectors-before-setting-chunk-sectors.patch +net-usb-qmi_wwan-add-telit-me910-pid-0x1101-support.patch +mtd-nand-gpmi-fix-failure-when-a-erased-page-has-a-bitflip-at-bbm.patch +mtd-nand-brcmnand-zero-bitflip-is-not-an-error.patch +ipv6-icmp6-allow-icmp-messages-to-be-looped-back.patch +arm-8731-1-fix-csum_partial_copy_from_user-stack-mismatch.patch +x86-asm-allow-again-using-asm.h-when-building-for-the-bpf-clang-target.patch +sget-handle-failures-of-register_shrinker.patch +net-phy-xgene-disable-clk-on-error-paths.patch +drm-nouveau-pci-do-a-msi-rearm-on-init.patch +mac80211_hwsim-fix-a-possible-sleep-in-atomic-bug-in-hwsim_get_radio_nl.patch +spi-atmel-fixed-spin_lock-usage-inside-atmel_spi_remove.patch +asoc-nau8825-fix-issue-that-pop-noise-when-start-capture.patch +net-mediatek-setup-proper-state-for-disabled-gmac-on-the-default.patch +net-arc_emac-fix-arc_emac_rx-error-paths.patch +ip6_tunnel-get-the-min-mtu-properly-in-ip6_tnl_xmit.patch +net-stmmac-fix-tx-timestamp-calculation.patch +scsi-storvsc-fix-scsi_cmd-error-assignments-in-storvsc_handle_error.patch +arm-dts-ls1021a-fix-incorrect-clock-references.patch +lib-mpi-fix-umul_ppmm-for-mips64r6.patch +tipc-error-path-leak-fixes-in-tipc_enable_bearer.patch +tipc-fix-tipc_mon_delete-oops-in-tipc_enable_bearer-error-path.patch +tg3-add-workaround-to-restrict-5762-mrrs-to-2048.patch +tg3-enable-phy-reset-in-mtu-change-path-for-5720.patch +bnx2x-improve-reliability-in-case-of-nested-pci-errors.patch +led-core-fix-brightness-setting-when-setting-delay_off-0.patch +ib-mlx5-fix-mlx5_ib_alloc_mr-error-flow.patch +genirq-guard-handle_bad_irq-log-messages.patch +s390-dasd-fix-wrongly-assigned-configuration-data.patch +ib-mlx4-fix-mlx4_ib_alloc_mr-error-flow.patch +ib-ipoib-fix-race-condition-in-neigh-creation.patch +xfs-quota-fix-missed-destroy-of-qi_tree_lock.patch +xfs-quota-check-result-of-register_shrinker.patch +macvlan-fix-one-possible-double-free.patch +e1000-fix-disabling-already-disabled-warning.patch +net-usb-qmi_wwan-add-support-for-yuga-clm920-nc5-pid-0x9625.patch +drm-ttm-check-the-return-value-of-kzalloc.patch +uapi-libc-compat-add-fallback-for-unsupported-libcs.patch +i40e-i40evf-account-for-frags-split-over-multiple-descriptors-in-check-linearize.patch +nl80211-check-for-the-required-netlink-attribute-presence.patch +mac80211-mesh-drop-frames-appearing-to-be-from-us.patch +can-flex_can-correct-the-checking-for-frame-length-in-flexcan_start_xmit.patch +bnxt_en-fix-the-invalid-vf-id-check-in-bnxt_vf_ndo_prep-routine.patch +xen-netfront-enable-device-after-manual-module-load.patch +mdio-sun4i-fix-a-memory-leak.patch +solutionengine771x-fix-ether-platform-data.patch +xen-gntdev-fix-off-by-one-error-when-unmapping-with-holes.patch +xen-gntdev-fix-partial-gntdev_mmap-cleanup.patch +sctp-make-use-of-pre-calculated-len.patch +net-gianfar_ptp-move-set_fipers-to-spinlock-protecting-area.patch diff --git a/queue-4.9/sget-handle-failures-of-register_shrinker.patch b/queue-4.9/sget-handle-failures-of-register_shrinker.patch new file mode 100644 index 00000000000..5e18dd505b3 --- /dev/null +++ b/queue-4.9/sget-handle-failures-of-register_shrinker.patch @@ -0,0 +1,32 @@ +From foo@baz Wed Feb 28 16:13:29 CET 2018 +From: Al Viro +Date: Mon, 18 Dec 2017 15:05:07 -0500 +Subject: sget(): handle failures of register_shrinker() + +From: Al Viro + + +[ Upstream commit 9ee332d99e4d5a97548943b81c54668450ce641b ] + +Signed-off-by: Al Viro +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + fs/super.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +--- a/fs/super.c ++++ b/fs/super.c +@@ -519,7 +519,11 @@ retry: + hlist_add_head(&s->s_instances, &type->fs_supers); + spin_unlock(&sb_lock); + get_filesystem(type); +- register_shrinker(&s->s_shrink); ++ err = register_shrinker(&s->s_shrink); ++ if (err) { ++ deactivate_locked_super(s); ++ s = ERR_PTR(err); ++ } + return s; + } + diff --git a/queue-4.9/solutionengine771x-fix-ether-platform-data.patch b/queue-4.9/solutionengine771x-fix-ether-platform-data.patch new file mode 100644 index 00000000000..39672b0d6f6 --- /dev/null +++ b/queue-4.9/solutionengine771x-fix-ether-platform-data.patch @@ -0,0 +1,65 @@ +From foo@baz Wed Feb 28 16:13:29 CET 2018 +From: Sergei Shtylyov +Date: Sat, 6 Jan 2018 21:53:26 +0300 +Subject: SolutionEngine771x: fix Ether platform data + +From: Sergei Shtylyov + + +[ Upstream commit 195e2addbce09e5afbc766efc1e6567c9ce840d3 ] + +The 'sh_eth' driver's probe() method would fail on the SolutionEngine7710 +board and crash on SolutionEngine7712 board as the platform code is +hopelessly behind the driver's platform data -- it passes the PHY address +instead of 'struct sh_eth_plat_data *'; pass the latter to the driver in +order to fix the bug... + +Fixes: 71557a37adb5 ("[netdrvr] sh_eth: Add SH7619 support") +Signed-off-by: Sergei Shtylyov +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + arch/sh/boards/mach-se/770x/setup.c | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) + +--- a/arch/sh/boards/mach-se/770x/setup.c ++++ b/arch/sh/boards/mach-se/770x/setup.c +@@ -8,6 +8,7 @@ + */ + #include + #include ++#include + #include + #include + #include +@@ -114,6 +115,11 @@ static struct platform_device heartbeat_ + #if defined(CONFIG_CPU_SUBTYPE_SH7710) ||\ + defined(CONFIG_CPU_SUBTYPE_SH7712) + /* SH771X Ethernet driver */ ++static struct sh_eth_plat_data sh_eth_plat = { ++ .phy = PHY_ID, ++ .phy_interface = PHY_INTERFACE_MODE_MII, ++}; ++ + static struct resource sh_eth0_resources[] = { + [0] = { + .start = SH_ETH0_BASE, +@@ -131,7 +137,7 @@ static struct platform_device sh_eth0_de + .name = "sh771x-ether", + .id = 0, + .dev = { +- .platform_data = PHY_ID, ++ .platform_data = &sh_eth_plat, + }, + .num_resources = ARRAY_SIZE(sh_eth0_resources), + .resource = sh_eth0_resources, +@@ -154,7 +160,7 @@ static struct platform_device sh_eth1_de + .name = "sh771x-ether", + .id = 1, + .dev = { +- .platform_data = PHY_ID, ++ .platform_data = &sh_eth_plat, + }, + .num_resources = ARRAY_SIZE(sh_eth1_resources), + .resource = sh_eth1_resources, diff --git a/queue-4.9/spi-atmel-fixed-spin_lock-usage-inside-atmel_spi_remove.patch b/queue-4.9/spi-atmel-fixed-spin_lock-usage-inside-atmel_spi_remove.patch new file mode 100644 index 00000000000..2e3c01e33fa --- /dev/null +++ b/queue-4.9/spi-atmel-fixed-spin_lock-usage-inside-atmel_spi_remove.patch @@ -0,0 +1,45 @@ +From foo@baz Wed Feb 28 16:13:29 CET 2018 +From: Radu Pirea +Date: Fri, 15 Dec 2017 17:40:17 +0200 +Subject: spi: atmel: fixed spin_lock usage inside atmel_spi_remove + +From: Radu Pirea + + +[ Upstream commit 66e900a3d225575c8b48b59ae1fe74bb6e5a65cc ] + +The only part of atmel_spi_remove which needs to be atomic is hardware +reset. + +atmel_spi_stop_dma calls dma_terminate_all and this needs interrupts +enabled. +atmel_spi_release_dma calls dma_release_channel and dma_release_channel +locks a mutex inside of spin_lock. + +So the call of these functions can't be inside a spin_lock. + +Reported-by: Jia-Ju Bai +Signed-off-by: Radu Pirea +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/spi/spi-atmel.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/spi/spi-atmel.c ++++ b/drivers/spi/spi-atmel.c +@@ -1669,12 +1669,12 @@ static int atmel_spi_remove(struct platf + pm_runtime_get_sync(&pdev->dev); + + /* reset the hardware and block queue progress */ +- spin_lock_irq(&as->lock); + if (as->use_dma) { + atmel_spi_stop_dma(as); + atmel_spi_release_dma(as); + } + ++ spin_lock_irq(&as->lock); + spi_writel(as, CR, SPI_BIT(SWRST)); + spi_writel(as, CR, SPI_BIT(SWRST)); /* AT91SAM9263 Rev B workaround */ + spi_readl(as, SR); diff --git a/queue-4.9/tg3-add-workaround-to-restrict-5762-mrrs-to-2048.patch b/queue-4.9/tg3-add-workaround-to-restrict-5762-mrrs-to-2048.patch new file mode 100644 index 00000000000..12d3683403c --- /dev/null +++ b/queue-4.9/tg3-add-workaround-to-restrict-5762-mrrs-to-2048.patch @@ -0,0 +1,64 @@ +From foo@baz Wed Feb 28 16:13:29 CET 2018 +From: Siva Reddy Kallam +Date: Fri, 22 Dec 2017 16:05:28 +0530 +Subject: tg3: Add workaround to restrict 5762 MRRS to 2048 + +From: Siva Reddy Kallam + + +[ Upstream commit 4419bb1cedcda0272e1dc410345c5a1d1da0e367 ] + +One of AMD based server with 5762 hangs with jumbo frame traffic. +This AMD platform has southbridge limitation which is restricting MRRS +to 4000. As a work around, driver to restricts the MRRS to 2048 for +this particular 5762 NX1 card. + +Signed-off-by: Siva Reddy Kallam +Signed-off-by: Michael Chan +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/ethernet/broadcom/tg3.c | 10 ++++++++++ + drivers/net/ethernet/broadcom/tg3.h | 4 ++++ + 2 files changed, 14 insertions(+) + +--- a/drivers/net/ethernet/broadcom/tg3.c ++++ b/drivers/net/ethernet/broadcom/tg3.c +@@ -10049,6 +10049,16 @@ static int tg3_reset_hw(struct tg3 *tp, + + tw32(GRC_MODE, tp->grc_mode | val); + ++ /* On one of the AMD platform, MRRS is restricted to 4000 because of ++ * south bridge limitation. As a workaround, Driver is setting MRRS ++ * to 2048 instead of default 4096. ++ */ ++ if (tp->pdev->subsystem_vendor == PCI_VENDOR_ID_DELL && ++ tp->pdev->subsystem_device == TG3PCI_SUBDEVICE_ID_DELL_5762) { ++ val = tr32(TG3PCI_DEV_STATUS_CTRL) & ~MAX_READ_REQ_MASK; ++ tw32(TG3PCI_DEV_STATUS_CTRL, val | MAX_READ_REQ_SIZE_2048); ++ } ++ + /* Setup the timer prescalar register. Clock is always 66Mhz. */ + val = tr32(GRC_MISC_CFG); + val &= ~0xff; +--- a/drivers/net/ethernet/broadcom/tg3.h ++++ b/drivers/net/ethernet/broadcom/tg3.h +@@ -95,6 +95,7 @@ + #define TG3PCI_SUBDEVICE_ID_DELL_JAGUAR 0x0106 + #define TG3PCI_SUBDEVICE_ID_DELL_MERLOT 0x0109 + #define TG3PCI_SUBDEVICE_ID_DELL_SLIM_MERLOT 0x010a ++#define TG3PCI_SUBDEVICE_ID_DELL_5762 0x07f0 + #define TG3PCI_SUBVENDOR_ID_COMPAQ PCI_VENDOR_ID_COMPAQ + #define TG3PCI_SUBDEVICE_ID_COMPAQ_BANSHEE 0x007c + #define TG3PCI_SUBDEVICE_ID_COMPAQ_BANSHEE_2 0x009a +@@ -280,6 +281,9 @@ + #define TG3PCI_STD_RING_PROD_IDX 0x00000098 /* 64-bit */ + #define TG3PCI_RCV_RET_RING_CON_IDX 0x000000a0 /* 64-bit */ + /* 0xa8 --> 0xb8 unused */ ++#define TG3PCI_DEV_STATUS_CTRL 0x000000b4 ++#define MAX_READ_REQ_SIZE_2048 0x00004000 ++#define MAX_READ_REQ_MASK 0x00007000 + #define TG3PCI_DUAL_MAC_CTRL 0x000000b8 + #define DUAL_MAC_CTRL_CH_MASK 0x00000003 + #define DUAL_MAC_CTRL_ID 0x00000004 diff --git a/queue-4.9/tg3-enable-phy-reset-in-mtu-change-path-for-5720.patch b/queue-4.9/tg3-enable-phy-reset-in-mtu-change-path-for-5720.patch new file mode 100644 index 00000000000..4cd11a2d383 --- /dev/null +++ b/queue-4.9/tg3-enable-phy-reset-in-mtu-change-path-for-5720.patch @@ -0,0 +1,36 @@ +From foo@baz Wed Feb 28 16:13:29 CET 2018 +From: Siva Reddy Kallam +Date: Fri, 22 Dec 2017 16:05:29 +0530 +Subject: tg3: Enable PHY reset in MTU change path for 5720 + +From: Siva Reddy Kallam + + +[ Upstream commit e60ee41aaf898584205a6af5c996860d0fe6a836 ] + +A customer noticed RX path hang when MTU is changed on the fly while +running heavy traffic with NCSI enabled for 5717 and 5719. Since 5720 +belongs to same ASIC family, we observed same issue and same fix +could solve this problem for 5720. + +Signed-off-by: Siva Reddy Kallam +Signed-off-by: Michael Chan +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/ethernet/broadcom/tg3.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/drivers/net/ethernet/broadcom/tg3.c ++++ b/drivers/net/ethernet/broadcom/tg3.c +@@ -14238,7 +14238,8 @@ static int tg3_change_mtu(struct net_dev + */ + if (tg3_asic_rev(tp) == ASIC_REV_57766 || + tg3_asic_rev(tp) == ASIC_REV_5717 || +- tg3_asic_rev(tp) == ASIC_REV_5719) ++ tg3_asic_rev(tp) == ASIC_REV_5719 || ++ tg3_asic_rev(tp) == ASIC_REV_5720) + reset_phy = true; + + err = tg3_restart_hw(tp, reset_phy); diff --git a/queue-4.9/tipc-error-path-leak-fixes-in-tipc_enable_bearer.patch b/queue-4.9/tipc-error-path-leak-fixes-in-tipc_enable_bearer.patch new file mode 100644 index 00000000000..0a98570000a --- /dev/null +++ b/queue-4.9/tipc-error-path-leak-fixes-in-tipc_enable_bearer.patch @@ -0,0 +1,45 @@ +From foo@baz Wed Feb 28 16:13:29 CET 2018 +From: Tommi Rantala +Date: Fri, 22 Dec 2017 09:35:16 +0200 +Subject: tipc: error path leak fixes in tipc_enable_bearer() + +From: Tommi Rantala + + +[ Upstream commit 19142551b2be4a9e13838099fde1351386e5e007 ] + +Fix memory leak in tipc_enable_bearer() if enable_media() fails, and +cleanup with bearer_disable() if tipc_mon_create() fails. + +Acked-by: Ying Xue +Acked-by: Jon Maloy +Signed-off-by: Tommi Rantala +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + net/tipc/bearer.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +--- a/net/tipc/bearer.c ++++ b/net/tipc/bearer.c +@@ -322,6 +322,7 @@ restart: + if (res) { + pr_warn("Bearer <%s> rejected, enable failure (%d)\n", + name, -res); ++ kfree(b); + return -EINVAL; + } + +@@ -345,8 +346,10 @@ restart: + if (skb) + tipc_bearer_xmit_skb(net, bearer_id, skb, &b->bcast_addr); + +- if (tipc_mon_create(net, bearer_id)) ++ if (tipc_mon_create(net, bearer_id)) { ++ bearer_disable(net, b); + return -ENOMEM; ++ } + + pr_info("Enabled bearer <%s>, discovery domain %s, priority %u\n", + name, diff --git a/queue-4.9/tipc-fix-tipc_mon_delete-oops-in-tipc_enable_bearer-error-path.patch b/queue-4.9/tipc-fix-tipc_mon_delete-oops-in-tipc_enable_bearer-error-path.patch new file mode 100644 index 00000000000..3eb0b98bfaa --- /dev/null +++ b/queue-4.9/tipc-fix-tipc_mon_delete-oops-in-tipc_enable_bearer-error-path.patch @@ -0,0 +1,82 @@ +From foo@baz Wed Feb 28 16:13:29 CET 2018 +From: Tommi Rantala +Date: Fri, 22 Dec 2017 09:35:17 +0200 +Subject: tipc: fix tipc_mon_delete() oops in tipc_enable_bearer() error path + +From: Tommi Rantala + + +[ Upstream commit 642a8439ddd8423b92f2e71960afe21ee1f66bb6 ] + +Calling tipc_mon_delete() before the monitor has been created will oops. +This can happen in tipc_enable_bearer() error path if tipc_disc_create() +fails. + +[ 48.589074] BUG: unable to handle kernel paging request at 0000000000001008 +[ 48.590266] IP: tipc_mon_delete+0xea/0x270 [tipc] +[ 48.591223] PGD 1e60c5067 P4D 1e60c5067 PUD 1eb0cf067 PMD 0 +[ 48.592230] Oops: 0000 [#1] SMP KASAN +[ 48.595610] CPU: 5 PID: 1199 Comm: tipc Tainted: G B 4.15.0-rc4-pc64-dirty #5 +[ 48.597176] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-2.fc27 04/01/2014 +[ 48.598489] RIP: 0010:tipc_mon_delete+0xea/0x270 [tipc] +[ 48.599347] RSP: 0018:ffff8801d827f668 EFLAGS: 00010282 +[ 48.600705] RAX: ffff8801ee813f00 RBX: 0000000000000204 RCX: 0000000000000000 +[ 48.602183] RDX: 1ffffffff1de6a75 RSI: 0000000000000297 RDI: 0000000000000297 +[ 48.604373] RBP: 0000000000000000 R08: 0000000000000000 R09: fffffbfff1dd1533 +[ 48.605607] R10: ffffffff8eafbb05 R11: fffffbfff1dd1534 R12: 0000000000000050 +[ 48.607082] R13: dead000000000200 R14: ffffffff8e73f310 R15: 0000000000001020 +[ 48.608228] FS: 00007fc686484800(0000) GS:ffff8801f5540000(0000) knlGS:0000000000000000 +[ 48.610189] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 +[ 48.611459] CR2: 0000000000001008 CR3: 00000001dda70002 CR4: 00000000003606e0 +[ 48.612759] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 +[ 48.613831] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 +[ 48.615038] Call Trace: +[ 48.615635] tipc_enable_bearer+0x415/0x5e0 [tipc] +[ 48.620623] tipc_nl_bearer_enable+0x1ab/0x200 [tipc] +[ 48.625118] genl_family_rcv_msg+0x36b/0x570 +[ 48.631233] genl_rcv_msg+0x5a/0xa0 +[ 48.631867] netlink_rcv_skb+0x1cc/0x220 +[ 48.636373] genl_rcv+0x24/0x40 +[ 48.637306] netlink_unicast+0x29c/0x350 +[ 48.639664] netlink_sendmsg+0x439/0x590 +[ 48.642014] SYSC_sendto+0x199/0x250 +[ 48.649912] do_syscall_64+0xfd/0x2c0 +[ 48.650651] entry_SYSCALL64_slow_path+0x25/0x25 +[ 48.651843] RIP: 0033:0x7fc6859848e3 +[ 48.652539] RSP: 002b:00007ffd25dff938 EFLAGS: 00000246 ORIG_RAX: 000000000000002c +[ 48.654003] RAX: ffffffffffffffda RBX: 00007ffd25dff990 RCX: 00007fc6859848e3 +[ 48.655303] RDX: 0000000000000054 RSI: 00007ffd25dff990 RDI: 0000000000000003 +[ 48.656512] RBP: 00007ffd25dff980 R08: 00007fc685c35fc0 R09: 000000000000000c +[ 48.657697] R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000d13010 +[ 48.658840] R13: 00007ffd25e009c0 R14: 0000000000000000 R15: 0000000000000000 +[ 48.662972] RIP: tipc_mon_delete+0xea/0x270 [tipc] RSP: ffff8801d827f668 +[ 48.664073] CR2: 0000000000001008 +[ 48.664576] ---[ end trace e811818d54d5ce88 ]--- + +Acked-by: Ying Xue +Acked-by: Jon Maloy +Signed-off-by: Tommi Rantala +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + net/tipc/monitor.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +--- a/net/tipc/monitor.c ++++ b/net/tipc/monitor.c +@@ -633,9 +633,13 @@ void tipc_mon_delete(struct net *net, in + { + struct tipc_net *tn = tipc_net(net); + struct tipc_monitor *mon = tipc_monitor(net, bearer_id); +- struct tipc_peer *self = get_self(net, bearer_id); ++ struct tipc_peer *self; + struct tipc_peer *peer, *tmp; + ++ if (!mon) ++ return; ++ ++ self = get_self(net, bearer_id); + write_lock_bh(&mon->lock); + tn->monitors[bearer_id] = NULL; + list_for_each_entry_safe(peer, tmp, &self->list, list) { diff --git a/queue-4.9/uapi-libc-compat-add-fallback-for-unsupported-libcs.patch b/queue-4.9/uapi-libc-compat-add-fallback-for-unsupported-libcs.patch new file mode 100644 index 00000000000..d5543c17448 --- /dev/null +++ b/queue-4.9/uapi-libc-compat-add-fallback-for-unsupported-libcs.patch @@ -0,0 +1,155 @@ +From foo@baz Wed Feb 28 16:13:29 CET 2018 +From: Felix Janda +Date: Mon, 1 Jan 2018 19:33:20 +0100 +Subject: uapi libc compat: add fallback for unsupported libcs + +From: Felix Janda + + +[ Upstream commit c0bace798436bca0fdc221ff61143f1376a9c3de ] + +libc-compat.h aims to prevent symbol collisions between uapi and libc +headers for each supported libc. This requires continuous coordination +between them. + +The goal of this commit is to improve the situation for libcs (such as +musl) which are not yet supported and/or do not wish to be explicitly +supported, while not affecting supported libcs. More precisely, with +this commit, unsupported libcs can request the suppression of any +specific uapi definition by defining the correspondings _UAPI_DEF_* +macro as 0. This can fix symbol collisions for them, as long as the +libc headers are included before the uapi headers. Inclusion in the +other order is outside the scope of this commit. + +All infrastructure in order to enable this fallback for unsupported +libcs is already in place, except that libc-compat.h unconditionally +defines all _UAPI_DEF_* macros to 1 for all unsupported libcs so that +any previous definitions are ignored. In order to fix this, this commit +merely makes these definitions conditional. + +This commit together with the musl libc commit + +http://git.musl-libc.org/cgit/musl/commit/?id=04983f2272382af92eb8f8838964ff944fbb8258 + +fixes for example the following compiler errors when is +included after musl's : + +./linux/in6.h:32:8: error: redefinition of 'struct in6_addr' +./linux/in6.h:49:8: error: redefinition of 'struct sockaddr_in6' +./linux/in6.h:59:8: error: redefinition of 'struct ipv6_mreq' + +The comments referencing glibc are still correct, but this file is not +only used for glibc any more. + +Signed-off-by: Felix Janda +Reviewed-by: Hauke Mehrtens +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + include/uapi/linux/libc-compat.h | 55 ++++++++++++++++++++++++++++++++++++++- + 1 file changed, 54 insertions(+), 1 deletion(-) + +--- a/include/uapi/linux/libc-compat.h ++++ b/include/uapi/linux/libc-compat.h +@@ -167,46 +167,99 @@ + + /* If we did not see any headers from any supported C libraries, + * or we are being included in the kernel, then define everything +- * that we need. */ ++ * that we need. Check for previous __UAPI_* definitions to give ++ * unsupported C libraries a way to opt out of any kernel definition. */ + #else /* !defined(__GLIBC__) */ + + /* Definitions for if.h */ ++#ifndef __UAPI_DEF_IF_IFCONF + #define __UAPI_DEF_IF_IFCONF 1 ++#endif ++#ifndef __UAPI_DEF_IF_IFMAP + #define __UAPI_DEF_IF_IFMAP 1 ++#endif ++#ifndef __UAPI_DEF_IF_IFNAMSIZ + #define __UAPI_DEF_IF_IFNAMSIZ 1 ++#endif ++#ifndef __UAPI_DEF_IF_IFREQ + #define __UAPI_DEF_IF_IFREQ 1 ++#endif + /* Everything up to IFF_DYNAMIC, matches net/if.h until glibc 2.23 */ ++#ifndef __UAPI_DEF_IF_NET_DEVICE_FLAGS + #define __UAPI_DEF_IF_NET_DEVICE_FLAGS 1 ++#endif + /* For the future if glibc adds IFF_LOWER_UP, IFF_DORMANT and IFF_ECHO */ ++#ifndef __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO + #define __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO 1 ++#endif + + /* Definitions for in.h */ ++#ifndef __UAPI_DEF_IN_ADDR + #define __UAPI_DEF_IN_ADDR 1 ++#endif ++#ifndef __UAPI_DEF_IN_IPPROTO + #define __UAPI_DEF_IN_IPPROTO 1 ++#endif ++#ifndef __UAPI_DEF_IN_PKTINFO + #define __UAPI_DEF_IN_PKTINFO 1 ++#endif ++#ifndef __UAPI_DEF_IP_MREQ + #define __UAPI_DEF_IP_MREQ 1 ++#endif ++#ifndef __UAPI_DEF_SOCKADDR_IN + #define __UAPI_DEF_SOCKADDR_IN 1 ++#endif ++#ifndef __UAPI_DEF_IN_CLASS + #define __UAPI_DEF_IN_CLASS 1 ++#endif + + /* Definitions for in6.h */ ++#ifndef __UAPI_DEF_IN6_ADDR + #define __UAPI_DEF_IN6_ADDR 1 ++#endif ++#ifndef __UAPI_DEF_IN6_ADDR_ALT + #define __UAPI_DEF_IN6_ADDR_ALT 1 ++#endif ++#ifndef __UAPI_DEF_SOCKADDR_IN6 + #define __UAPI_DEF_SOCKADDR_IN6 1 ++#endif ++#ifndef __UAPI_DEF_IPV6_MREQ + #define __UAPI_DEF_IPV6_MREQ 1 ++#endif ++#ifndef __UAPI_DEF_IPPROTO_V6 + #define __UAPI_DEF_IPPROTO_V6 1 ++#endif ++#ifndef __UAPI_DEF_IPV6_OPTIONS + #define __UAPI_DEF_IPV6_OPTIONS 1 ++#endif ++#ifndef __UAPI_DEF_IN6_PKTINFO + #define __UAPI_DEF_IN6_PKTINFO 1 ++#endif ++#ifndef __UAPI_DEF_IP6_MTUINFO + #define __UAPI_DEF_IP6_MTUINFO 1 ++#endif + + /* Definitions for ipx.h */ ++#ifndef __UAPI_DEF_SOCKADDR_IPX + #define __UAPI_DEF_SOCKADDR_IPX 1 ++#endif ++#ifndef __UAPI_DEF_IPX_ROUTE_DEFINITION + #define __UAPI_DEF_IPX_ROUTE_DEFINITION 1 ++#endif ++#ifndef __UAPI_DEF_IPX_INTERFACE_DEFINITION + #define __UAPI_DEF_IPX_INTERFACE_DEFINITION 1 ++#endif ++#ifndef __UAPI_DEF_IPX_CONFIG_DATA + #define __UAPI_DEF_IPX_CONFIG_DATA 1 ++#endif ++#ifndef __UAPI_DEF_IPX_ROUTE_DEF + #define __UAPI_DEF_IPX_ROUTE_DEF 1 ++#endif + + /* Definitions for xattr.h */ ++#ifndef __UAPI_DEF_XATTR + #define __UAPI_DEF_XATTR 1 ++#endif + + #endif /* __GLIBC__ */ + diff --git a/queue-4.9/x86-asm-allow-again-using-asm.h-when-building-for-the-bpf-clang-target.patch b/queue-4.9/x86-asm-allow-again-using-asm.h-when-building-for-the-bpf-clang-target.patch new file mode 100644 index 00000000000..7dd8e25afdb --- /dev/null +++ b/queue-4.9/x86-asm-allow-again-using-asm.h-when-building-for-the-bpf-clang-target.patch @@ -0,0 +1,202 @@ +From foo@baz Wed Feb 28 16:13:29 CET 2018 +From: Arnaldo Carvalho de Melo +Date: Mon, 4 Dec 2017 13:08:47 -0300 +Subject: x86/asm: Allow again using asm.h when building for the 'bpf' clang target + +From: Arnaldo Carvalho de Melo + + +[ Upstream commit ca26cffa4e4aaeb09bb9e308f95c7835cb149248 ] + +Up to f5caf621ee35 ("x86/asm: Fix inline asm call constraints for Clang") +we were able to use x86 headers to build to the 'bpf' clang target, as +done by the BPF code in tools/perf/. + +With that commit, we ended up with following failure for 'perf test LLVM', this +is because "clang ... -target bpf ..." fails since 4.0 does not have bpf inline +asm support and 6.0 does not recognize the register 'esp', fix it by guarding +that part with an #ifndef __BPF__, that is defined by clang when building to +the "bpf" target. + + # perf test -v LLVM + 37: LLVM search and compile : + 37.1: Basic BPF llvm compile : + --- start --- + test child forked, pid 25526 + Kernel build dir is set to /lib/modules/4.14.0+/build + set env: KBUILD_DIR=/lib/modules/4.14.0+/build + unset env: KBUILD_OPTS + include option is set to -nostdinc -isystem /usr/lib/gcc/x86_64-redhat-linux/7/include -I/home/acme/git/linux/arch/x86/include -I./arch/x86/include/generated -I/home/acme/git/linux/include -I./include -I/home/acme/git/linux/arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I/home/acme/git/linux/include/uapi -I./include/generated/uapi -include /home/acme/git/linux/include/linux/kconfig.h + set env: NR_CPUS=4 + set env: LINUX_VERSION_CODE=0x40e00 + set env: CLANG_EXEC=/usr/local/bin/clang + set env: CLANG_OPTIONS=-xc + set env: KERNEL_INC_OPTIONS= -nostdinc -isystem /usr/lib/gcc/x86_64-redhat-linux/7/include -I/home/acme/git/linux/arch/x86/include -I./arch/x86/include/generated -I/home/acme/git/linux/include -I./include -I/home/acme/git/linux/arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I/home/acme/git/linux/include/uapi -I./include/generated/uapi -include /home/acme/git/linux/include/linux/kconfig.h + set env: WORKING_DIR=/lib/modules/4.14.0+/build + set env: CLANG_SOURCE=- + llvm compiling command template: echo '/* + * bpf-script-example.c + * Test basic LLVM building + */ + #ifndef LINUX_VERSION_CODE + # error Need LINUX_VERSION_CODE + # error Example: for 4.2 kernel, put 'clang-opt="-DLINUX_VERSION_CODE=0x40200" into llvm section of ~/.perfconfig' + #endif + #define BPF_ANY 0 + #define BPF_MAP_TYPE_ARRAY 2 + #define BPF_FUNC_map_lookup_elem 1 + #define BPF_FUNC_map_update_elem 2 + + static void *(*bpf_map_lookup_elem)(void *map, void *key) = + (void *) BPF_FUNC_map_lookup_elem; + static void *(*bpf_map_update_elem)(void *map, void *key, void *value, int flags) = + (void *) BPF_FUNC_map_update_elem; + + struct bpf_map_def { + unsigned int type; + unsigned int key_size; + unsigned int value_size; + unsigned int max_entries; + }; + + #define SEC(NAME) __attribute__((section(NAME), used)) + struct bpf_map_def SEC("maps") flip_table = { + .type = BPF_MAP_TYPE_ARRAY, + .key_size = sizeof(int), + .value_size = sizeof(int), + .max_entries = 1, + }; + + SEC("func=SyS_epoll_wait") + int bpf_func__SyS_epoll_wait(void *ctx) + { + int ind =0; + int *flag = bpf_map_lookup_elem(&flip_table, &ind); + int new_flag; + if (!flag) + return 0; + /* flip flag and store back */ + new_flag = !*flag; + bpf_map_update_elem(&flip_table, &ind, &new_flag, BPF_ANY); + return new_flag; + } + char _license[] SEC("license") = "GPL"; + int _version SEC("version") = LINUX_VERSION_CODE; + ' | $CLANG_EXEC -D__KERNEL__ -D__NR_CPUS__=$NR_CPUS -DLINUX_VERSION_CODE=$LINUX_VERSION_CODE $CLANG_OPTIONS $KERNEL_INC_OPTIONS -Wno-unused-value -Wno-pointer-sign -working-directory $WORKING_DIR -c "$CLANG_SOURCE" -target bpf -O2 -o - + test child finished with 0 + ---- end ---- + LLVM search and compile subtest 0: Ok + 37.2: kbuild searching : + --- start --- + test child forked, pid 25950 + Kernel build dir is set to /lib/modules/4.14.0+/build + set env: KBUILD_DIR=/lib/modules/4.14.0+/build + unset env: KBUILD_OPTS + include option is set to -nostdinc -isystem /usr/lib/gcc/x86_64-redhat-linux/7/include -I/home/acme/git/linux/arch/x86/include -I./arch/x86/include/generated -I/home/acme/git/linux/include -I./include -I/home/acme/git/linux/arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I/home/acme/git/linux/include/uapi -I./include/generated/uapi -include /home/acme/git/linux/include/linux/kconfig.h + set env: NR_CPUS=4 + set env: LINUX_VERSION_CODE=0x40e00 + set env: CLANG_EXEC=/usr/local/bin/clang + set env: CLANG_OPTIONS=-xc + set env: KERNEL_INC_OPTIONS= -nostdinc -isystem /usr/lib/gcc/x86_64-redhat-linux/7/include -I/home/acme/git/linux/arch/x86/include -I./arch/x86/include/generated -I/home/acme/git/linux/include -I./include -I/home/acme/git/linux/arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I/home/acme/git/linux/include/uapi -I./include/generated/uapi -include /home/acme/git/linux/include/linux/kconfig.h + set env: WORKING_DIR=/lib/modules/4.14.0+/build + set env: CLANG_SOURCE=- + llvm compiling command template: echo '/* + * bpf-script-test-kbuild.c + * Test include from kernel header + */ + #ifndef LINUX_VERSION_CODE + # error Need LINUX_VERSION_CODE + # error Example: for 4.2 kernel, put 'clang-opt="-DLINUX_VERSION_CODE=0x40200" into llvm section of ~/.perfconfig' + #endif + #define SEC(NAME) __attribute__((section(NAME), used)) + + #include + #include + + SEC("func=vfs_llseek") + int bpf_func__vfs_llseek(void *ctx) + { + return 0; + } + + char _license[] SEC("license") = "GPL"; + int _version SEC("version") = LINUX_VERSION_CODE; + ' | $CLANG_EXEC -D__KERNEL__ -D__NR_CPUS__=$NR_CPUS -DLINUX_VERSION_CODE=$LINUX_VERSION_CODE $CLANG_OPTIONS $KERNEL_INC_OPTIONS -Wno-unused-value -Wno-pointer-sign -working-directory $WORKING_DIR -c "$CLANG_SOURCE" -target bpf -O2 -o - + In file included from :12: + In file included from /home/acme/git/linux/arch/x86/include/uapi/asm/ptrace.h:5: + In file included from /home/acme/git/linux/include/linux/compiler.h:242: + In file included from /home/acme/git/linux/arch/x86/include/asm/barrier.h:5: + In file included from /home/acme/git/linux/arch/x86/include/asm/alternative.h:10: + /home/acme/git/linux/arch/x86/include/asm/asm.h:145:50: error: unknown register name 'esp' in asm + register unsigned long current_stack_pointer asm(_ASM_SP); + ^ + /home/acme/git/linux/arch/x86/include/asm/asm.h:44:18: note: expanded from macro '_ASM_SP' + #define _ASM_SP __ASM_REG(sp) + ^ + /home/acme/git/linux/arch/x86/include/asm/asm.h:27:32: note: expanded from macro '__ASM_REG' + #define __ASM_REG(reg) __ASM_SEL_RAW(e##reg, r##reg) + ^ + /home/acme/git/linux/arch/x86/include/asm/asm.h:18:29: note: expanded from macro '__ASM_SEL_RAW' + # define __ASM_SEL_RAW(a,b) __ASM_FORM_RAW(a) + ^ + /home/acme/git/linux/arch/x86/include/asm/asm.h:11:32: note: expanded from macro '__ASM_FORM_RAW' + # define __ASM_FORM_RAW(x) #x + ^ + :4:1: note: expanded from here + "esp" + ^ + 1 error generated. + ERROR: unable to compile - + Hint: Check error message shown above. + Hint: You can also pre-compile it into .o using: + clang -target bpf -O2 -c - + with proper -I and -D options. + Failed to compile test case: 'kbuild searching' + test child finished with -1 + ---- end ---- + LLVM search and compile subtest 1: FAILED! + +Cc: Adrian Hunter +Cc: Alexander Potapenko +Cc: Alexei Starovoitov +Cc: Andrey Ryabinin +Cc: Andy Lutomirski +Cc: Arnd Bergmann +Cc: Daniel Borkmann +Cc: David Ahern +Cc: Dmitriy Vyukov +Cc: Jiri Olsa +Cc: Josh Poimboeuf +Cc: Linus Torvalds +Cc: Matthias Kaehlcke +Cc: Miguel Bernal Marin +Cc: Namhyung Kim +Cc: Peter Zijlstra +Cc: Thomas Gleixner +Cc: Wang Nan +Cc: Yonghong Song +Link: https://lkml.kernel.org/r/20171128175948.GL3298@kernel.org +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + arch/x86/include/asm/asm.h | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/arch/x86/include/asm/asm.h ++++ b/arch/x86/include/asm/asm.h +@@ -128,6 +128,7 @@ + #endif + + #ifndef __ASSEMBLY__ ++#ifndef __BPF__ + /* + * This output constraint should be used for any inline asm which has a "call" + * instruction. Otherwise the asm may be inserted before the frame pointer +@@ -137,5 +138,6 @@ + register unsigned long current_stack_pointer asm(_ASM_SP); + #define ASM_CALL_CONSTRAINT "+r" (current_stack_pointer) + #endif ++#endif + + #endif /* _ASM_X86_ASM_H */ diff --git a/queue-4.9/xen-gntdev-fix-off-by-one-error-when-unmapping-with-holes.patch b/queue-4.9/xen-gntdev-fix-off-by-one-error-when-unmapping-with-holes.patch new file mode 100644 index 00000000000..ec990315052 --- /dev/null +++ b/queue-4.9/xen-gntdev-fix-off-by-one-error-when-unmapping-with-holes.patch @@ -0,0 +1,36 @@ +From foo@baz Wed Feb 28 16:13:29 CET 2018 +From: Ross Lagerwall +Date: Tue, 9 Jan 2018 12:10:21 +0000 +Subject: xen/gntdev: Fix off-by-one error when unmapping with holes + +From: Ross Lagerwall + + +[ Upstream commit 951a010233625b77cde3430b4b8785a9a22968d1 ] + +If the requested range has a hole, the calculation of the number of +pages to unmap is off by one. Fix it. + +Signed-off-by: Ross Lagerwall +Reviewed-by: Boris Ostrovsky +Signed-off-by: Boris Ostrovsky +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/xen/gntdev.c | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +--- a/drivers/xen/gntdev.c ++++ b/drivers/xen/gntdev.c +@@ -378,10 +378,8 @@ static int unmap_grant_pages(struct gran + } + range = 0; + while (range < pages) { +- if (map->unmap_ops[offset+range].handle == -1) { +- range--; ++ if (map->unmap_ops[offset+range].handle == -1) + break; +- } + range++; + } + err = __unmap_grant_pages(map, offset, range); diff --git a/queue-4.9/xen-gntdev-fix-partial-gntdev_mmap-cleanup.patch b/queue-4.9/xen-gntdev-fix-partial-gntdev_mmap-cleanup.patch new file mode 100644 index 00000000000..a9bc52ace57 --- /dev/null +++ b/queue-4.9/xen-gntdev-fix-partial-gntdev_mmap-cleanup.patch @@ -0,0 +1,42 @@ +From foo@baz Wed Feb 28 16:13:29 CET 2018 +From: Ross Lagerwall +Date: Tue, 9 Jan 2018 12:10:22 +0000 +Subject: xen/gntdev: Fix partial gntdev_mmap() cleanup + +From: Ross Lagerwall + + +[ Upstream commit cf2acf66ad43abb39735568f55e1f85f9844e990 ] + +When cleaning up after a partially successful gntdev_mmap(), unmap the +successfully mapped grant pages otherwise Xen will kill the domain if +in debug mode (Attempt to implicitly unmap a granted PTE) or Linux will +kill the process and emit "BUG: Bad page map in process" if Xen is in +release mode. + +This is only needed when use_ptemod is true because gntdev_put_map() +will unmap grant pages itself when use_ptemod is false. + +Signed-off-by: Ross Lagerwall +Reviewed-by: Boris Ostrovsky +Signed-off-by: Boris Ostrovsky +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/xen/gntdev.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +--- a/drivers/xen/gntdev.c ++++ b/drivers/xen/gntdev.c +@@ -1077,8 +1077,10 @@ unlock_out: + out_unlock_put: + mutex_unlock(&priv->lock); + out_put_map: +- if (use_ptemod) ++ if (use_ptemod) { + map->vma = NULL; ++ unmap_grant_pages(map, 0, map->count); ++ } + gntdev_put_map(priv, map); + return err; + } diff --git a/queue-4.9/xen-netfront-enable-device-after-manual-module-load.patch b/queue-4.9/xen-netfront-enable-device-after-manual-module-load.patch new file mode 100644 index 00000000000..1a7baffaac4 --- /dev/null +++ b/queue-4.9/xen-netfront-enable-device-after-manual-module-load.patch @@ -0,0 +1,45 @@ +From foo@baz Wed Feb 28 16:13:29 CET 2018 +From: Eduardo Otubo +Date: Fri, 5 Jan 2018 09:42:16 +0100 +Subject: xen-netfront: enable device after manual module load + +From: Eduardo Otubo + + +[ Upstream commit b707fda2df4070785d0fa8a278aa13944c5f51f8 ] + +When loading the module after unloading it, the network interface would +not be enabled and thus wouldn't have a backend counterpart and unable +to be used by the guest. + +The guest would face errors like: + + [root@guest ~]# ethtool -i eth0 + Cannot get driver information: No such device + + [root@guest ~]# ifconfig eth0 + eth0: error fetching interface information: Device not found + +This patch initializes the state of the netfront device whenever it is +loaded manually, this state would communicate the netback to create its +device and establish the connection between them. + +Signed-off-by: Eduardo Otubo +Reviewed-by: Boris Ostrovsky +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/xen-netfront.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/net/xen-netfront.c ++++ b/drivers/net/xen-netfront.c +@@ -1345,6 +1345,7 @@ static struct net_device *xennet_create_ + + netif_carrier_off(netdev); + ++ xenbus_switch_state(dev, XenbusStateInitialising); + return netdev; + + exit: diff --git a/queue-4.9/xfs-quota-check-result-of-register_shrinker.patch b/queue-4.9/xfs-quota-check-result-of-register_shrinker.patch new file mode 100644 index 00000000000..b8c7e3b0af9 --- /dev/null +++ b/queue-4.9/xfs-quota-check-result-of-register_shrinker.patch @@ -0,0 +1,108 @@ +From foo@baz Wed Feb 28 16:13:29 CET 2018 +From: Aliaksei Karaliou +Date: Thu, 21 Dec 2017 13:18:26 -0800 +Subject: xfs: quota: check result of register_shrinker() + +From: Aliaksei Karaliou + + +[ Upstream commit 3a3882ff26fbdbaf5f7e13f6a0bccfbf7121041d ] + +xfs_qm_init_quotainfo() does not check result of register_shrinker() +which was tagged as __must_check recently, reported by sparse. + +Signed-off-by: Aliaksei Karaliou +[darrick: move xfs_qm_destroy_quotainos nearer xfs_qm_init_quotainos] +Reviewed-by: Darrick J. Wong +Signed-off-by: Darrick J. Wong + +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + fs/xfs/xfs_qm.c | 45 +++++++++++++++++++++++++++++---------------- + 1 file changed, 29 insertions(+), 16 deletions(-) + +--- a/fs/xfs/xfs_qm.c ++++ b/fs/xfs/xfs_qm.c +@@ -47,7 +47,7 @@ + STATIC int xfs_qm_init_quotainos(xfs_mount_t *); + STATIC int xfs_qm_init_quotainfo(xfs_mount_t *); + +- ++STATIC void xfs_qm_destroy_quotainos(xfs_quotainfo_t *qi); + STATIC void xfs_qm_dqfree_one(struct xfs_dquot *dqp); + /* + * We use the batch lookup interface to iterate over the dquots as it +@@ -694,9 +694,17 @@ xfs_qm_init_quotainfo( + qinf->qi_shrinker.scan_objects = xfs_qm_shrink_scan; + qinf->qi_shrinker.seeks = DEFAULT_SEEKS; + qinf->qi_shrinker.flags = SHRINKER_NUMA_AWARE; +- register_shrinker(&qinf->qi_shrinker); ++ ++ error = register_shrinker(&qinf->qi_shrinker); ++ if (error) ++ goto out_free_inos; ++ + return 0; + ++out_free_inos: ++ mutex_destroy(&qinf->qi_quotaofflock); ++ mutex_destroy(&qinf->qi_tree_lock); ++ xfs_qm_destroy_quotainos(qinf); + out_free_lru: + list_lru_destroy(&qinf->qi_lru); + out_free_qinf: +@@ -705,7 +713,6 @@ out_free_qinf: + return error; + } + +- + /* + * Gets called when unmounting a filesystem or when all quotas get + * turned off. +@@ -722,19 +729,7 @@ xfs_qm_destroy_quotainfo( + + unregister_shrinker(&qi->qi_shrinker); + list_lru_destroy(&qi->qi_lru); +- +- if (qi->qi_uquotaip) { +- IRELE(qi->qi_uquotaip); +- qi->qi_uquotaip = NULL; /* paranoia */ +- } +- if (qi->qi_gquotaip) { +- IRELE(qi->qi_gquotaip); +- qi->qi_gquotaip = NULL; +- } +- if (qi->qi_pquotaip) { +- IRELE(qi->qi_pquotaip); +- qi->qi_pquotaip = NULL; +- } ++ xfs_qm_destroy_quotainos(qi); + mutex_destroy(&qi->qi_tree_lock); + mutex_destroy(&qi->qi_quotaofflock); + kmem_free(qi); +@@ -1621,6 +1616,24 @@ error_rele: + } + + STATIC void ++xfs_qm_destroy_quotainos( ++ xfs_quotainfo_t *qi) ++{ ++ if (qi->qi_uquotaip) { ++ IRELE(qi->qi_uquotaip); ++ qi->qi_uquotaip = NULL; /* paranoia */ ++ } ++ if (qi->qi_gquotaip) { ++ IRELE(qi->qi_gquotaip); ++ qi->qi_gquotaip = NULL; ++ } ++ if (qi->qi_pquotaip) { ++ IRELE(qi->qi_pquotaip); ++ qi->qi_pquotaip = NULL; ++ } ++} ++ ++STATIC void + xfs_qm_dqfree_one( + struct xfs_dquot *dqp) + { diff --git a/queue-4.9/xfs-quota-fix-missed-destroy-of-qi_tree_lock.patch b/queue-4.9/xfs-quota-fix-missed-destroy-of-qi_tree_lock.patch new file mode 100644 index 00000000000..03a8ff665e5 --- /dev/null +++ b/queue-4.9/xfs-quota-fix-missed-destroy-of-qi_tree_lock.patch @@ -0,0 +1,32 @@ +From foo@baz Wed Feb 28 16:13:29 CET 2018 +From: Aliaksei Karaliou +Date: Thu, 21 Dec 2017 13:18:26 -0800 +Subject: xfs: quota: fix missed destroy of qi_tree_lock + +From: Aliaksei Karaliou + + +[ Upstream commit 2196881566225f3c3428d1a5f847a992944daa5b ] + +xfs_qm_destroy_quotainfo() does not destroy quotainfo->qi_tree_lock +while destroys quotainfo->qi_quotaofflock. + +Signed-off-by: Aliaksei Karaliou +Reviewed-by: Darrick J. Wong +Signed-off-by: Darrick J. Wong +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + fs/xfs/xfs_qm.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/fs/xfs/xfs_qm.c ++++ b/fs/xfs/xfs_qm.c +@@ -735,6 +735,7 @@ xfs_qm_destroy_quotainfo( + IRELE(qi->qi_pquotaip); + qi->qi_pquotaip = NULL; + } ++ mutex_destroy(&qi->qi_tree_lock); + mutex_destroy(&qi->qi_quotaofflock); + kmem_free(qi); + mp->m_quotainfo = NULL;