From: Greg Kroah-Hartman Date: Sun, 26 Aug 2018 07:16:47 +0000 (+0200) Subject: 4.9-stable patches X-Git-Tag: v3.18.120~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d571d0ab8ea8260ac3c2b5615ba79f2ce6ffc8b2;p=thirdparty%2Fkernel%2Fstable-queue.git 4.9-stable patches added patches: arc-fix-build-errors-in-arc-include-asm-delay.h.patch arc-fix-data-type-errors-in-platform-headers.patch arc-fix-type-warnings-in-arc-mm-cache.c.patch atl1c-reserve-min-skb-headroom.patch bnx2x-fix-invalid-memory-access-in-rss-hash-config-path.patch bpf-ppc64-fix-unexpected-r0-0-exit-path-inside-bpf_xadd.patch cachefiles-fix-refcounting-bug-in-backing-file-read-monitoring.patch cachefiles-wait-rather-than-bug-ing-on-unexpected-object-collision.patch can-mpc5xxx_can-check-of_iomap-return-before-use.patch drivers-net-lmc-fix-case-value-for-target-abort-error.patch drm-bridge-adv7511-reset-registers-on-hotplug.patch drm-imx-imx-ldb-check-if-channel-is-enabled-before-printing-warning.patch drm-imx-imx-ldb-disable-ldb-on-driver-bind.patch drm-re-enable-error-handling.patch enic-handle-mtu-change-for-vf-properly.patch fscache-allow-cancelled-operations-to-be-enqueued.patch i2c-davinci-avoid-zero-value-of-clkh.patch mac80211-add-stations-tied-to-ap_vlans-during-hw-reconfig.patch media-staging-omap4iss-include-asm-cacheflush.h-after-generic-includes.patch memcg-remove-memcg_cgroup-id-from-idr-on-mem_cgroup_css_alloc-failure.patch mm-memory.c-check-return-value-of-ioremap_prot.patch net-axienet-fix-double-deregister-of-mdio.patch net-caif-add-a-missing-rcu_read_unlock-in-caif_flow_cb.patch net-prevent-isa-drivers-from-building-on-ppc32.patch nl80211-add-a-missing-break-in-parse_station_flags.patch perf-x86-amd-ibs-don-t-access-non-started-event.patch qed-correct-multicast-api-to-reflect-existence-of-256-approximate-buckets.patch qed-fix-possible-race-for-the-link-state-value.patch qmi_wwan-fix-interface-number-for-dw5821e-production-firmware.patch revert-mips-bcm47xx-enable-74k-core-externalsync-for-pcie-erratum.patch scsi-fcoe-clear-fc_rp_started-flags-when-receiving-a-logo.patch scsi-fcoe-drop-frames-in-els-logo-error-path.patch scsi-libiscsi-fix-possible-null-pointer-dereference-in-case-of-tmf.patch scsi-vmw_pvscsi-return-did_reset-for-status-sam_stat_command_terminated.patch selftests-ftrace-add-snapshot-and-tracing_on-test-case.patch squashfs-compute-expected-length-from-inode-size-rather-than-block-length.patch squashfs-metadata-2-electric-boogaloo.patch tools-power-turbostat-fix-s-on-up-systems.patch tools-power-turbostat-read-extended-processor-family-from-cpuid.patch tools-usb-ffs-test-fix-build-on-big-endian-systems.patch usb-gadget-f_uac2-fix-endianness-of-struct-cntrl_-_lay3.patch usb-gadget-r8a66597-fix-a-possible-sleep-in-atomic-context-bugs-in-r8a66597_queue.patch usb-gadget-r8a66597-fix-two-possible-sleep-in-atomic-context-bugs-in-init_controller.patch usb-phy-fix-ppc64-build-errors-in-phy-fsl-usb.c.patch vti6-fix-pmtu-caching-and-reporting-on-xmit.patch x86-boot-fix-if_changed-build-flip-flop-bug.patch xfrm-fix-missing-dst_release-after-policy-blocking-lbcast-and-multicast.patch xfrm-free-skb-if-nlsk-pointer-is-null.patch zswap-re-check-zswap_is_full-after-do-zswap_shrink.patch --- diff --git a/queue-4.9/arc-fix-build-errors-in-arc-include-asm-delay.h.patch b/queue-4.9/arc-fix-build-errors-in-arc-include-asm-delay.h.patch new file mode 100644 index 00000000000..b1b00e7c89f --- /dev/null +++ b/queue-4.9/arc-fix-build-errors-in-arc-include-asm-delay.h.patch @@ -0,0 +1,52 @@ +From foo@baz Sun Aug 26 09:16:12 CEST 2018 +From: Randy Dunlap +Date: Thu, 26 Jul 2018 20:16:35 -0700 +Subject: arc: fix build errors in arc/include/asm/delay.h + +From: Randy Dunlap + +[ Upstream commit 2423665ec53f2a29191b35382075e9834288a975 ] + +Fix build errors in arch/arc/'s delay.h: +- add "extern unsigned long loops_per_jiffy;" +- add for "u64" + +In file included from ../drivers/infiniband/hw/cxgb3/cxio_hal.c:32: +../arch/arc/include/asm/delay.h: In function '__udelay': +../arch/arc/include/asm/delay.h:61:12: error: 'u64' undeclared (first use in this function) + loops = ((u64) usecs * 4295 * HZ * loops_per_jiffy) >> 32; + ^~~ + +In file included from ../drivers/infiniband/hw/cxgb3/cxio_hal.c:32: +../arch/arc/include/asm/delay.h: In function '__udelay': +../arch/arc/include/asm/delay.h:63:37: error: 'loops_per_jiffy' undeclared (first use in this function) + loops = ((u64) usecs * 4295 * HZ * loops_per_jiffy) >> 32; + ^~~~~~~~~~~~~~~ + +Signed-off-by: Randy Dunlap +Cc: Vineet Gupta +Cc: linux-snps-arc@lists.infradead.org +Cc: Elad Kanfi +Cc: Leon Romanovsky +Cc: Ofer Levi +Signed-off-by: Vineet Gupta +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + arch/arc/include/asm/delay.h | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/arch/arc/include/asm/delay.h ++++ b/arch/arc/include/asm/delay.h +@@ -17,8 +17,11 @@ + #ifndef __ASM_ARC_UDELAY_H + #define __ASM_ARC_UDELAY_H + ++#include + #include /* HZ */ + ++extern unsigned long loops_per_jiffy; ++ + static inline void __delay(unsigned long loops) + { + __asm__ __volatile__( diff --git a/queue-4.9/arc-fix-data-type-errors-in-platform-headers.patch b/queue-4.9/arc-fix-data-type-errors-in-platform-headers.patch new file mode 100644 index 00000000000..cd6f3c56f77 --- /dev/null +++ b/queue-4.9/arc-fix-data-type-errors-in-platform-headers.patch @@ -0,0 +1,53 @@ +From foo@baz Sun Aug 26 09:16:12 CEST 2018 +From: Randy Dunlap +Date: Sun, 29 Jul 2018 11:10:51 -0700 +Subject: arc: [plat-eznps] fix data type errors in platform headers + +From: Randy Dunlap + +[ Upstream commit b1f32ce1c3d2c11959b7e6a2c58dc5197c581966 ] + +Add to fix build errors. +Both ctop.h and use u32 types and cause many +errors. + +Examples: +../include/soc/nps/common.h:71:4: error: unknown type name 'u32' + u32 __reserved:20, cluster:4, core:4, thread:4; +../include/soc/nps/common.h:76:3: error: unknown type name 'u32' + u32 value; +../include/soc/nps/common.h:124:4: error: unknown type name 'u32' + u32 base:8, cl_x:4, cl_y:4, +../include/soc/nps/common.h:127:3: error: unknown type name 'u32' + u32 value; + +../arch/arc/plat-eznps/include/plat/ctop.h:83:4: error: unknown type name 'u32' + u32 gen:1, gdis:1, clk_gate_dis:1, asb:1, +../arch/arc/plat-eznps/include/plat/ctop.h:86:3: error: unknown type name 'u32' + u32 value; +../arch/arc/plat-eznps/include/plat/ctop.h:93:4: error: unknown type name 'u32' + u32 csa:22, dmsid:6, __reserved:3, cs:1; +../arch/arc/plat-eznps/include/plat/ctop.h:95:3: error: unknown type name 'u32' + u32 value; + +Cc: linux-snps-arc@lists.infradead.org +Cc: Ofer Levi +Reviewed-by: Leon Romanovsky +Signed-off-by: Randy Dunlap +Signed-off-by: Vineet Gupta +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + arch/arc/plat-eznps/include/plat/ctop.h | 1 + + 1 file changed, 1 insertion(+) + +--- a/arch/arc/plat-eznps/include/plat/ctop.h ++++ b/arch/arc/plat-eznps/include/plat/ctop.h +@@ -21,6 +21,7 @@ + #error "Incorrect ctop.h include" + #endif + ++#include + #include + + /* core auxiliary registers */ diff --git a/queue-4.9/arc-fix-type-warnings-in-arc-mm-cache.c.patch b/queue-4.9/arc-fix-type-warnings-in-arc-mm-cache.c.patch new file mode 100644 index 00000000000..7a25f83562d --- /dev/null +++ b/queue-4.9/arc-fix-type-warnings-in-arc-mm-cache.c.patch @@ -0,0 +1,55 @@ +From foo@baz Sun Aug 26 09:16:12 CEST 2018 +From: Randy Dunlap +Date: Thu, 26 Jul 2018 20:16:35 -0700 +Subject: arc: fix type warnings in arc/mm/cache.c + +From: Randy Dunlap + +[ Upstream commit ec837d620c750c0d4996a907c8c4f7febe1bbeee ] + +Fix type warnings in arch/arc/mm/cache.c. + +../arch/arc/mm/cache.c: In function 'flush_anon_page': +../arch/arc/mm/cache.c:1062:55: warning: passing argument 2 of '__flush_dcache_page' makes integer from pointer without a cast [-Wint-conversion] + __flush_dcache_page((phys_addr_t)page_address(page), page_address(page)); + ^~~~~~~~~~~~~~~~~~ +../arch/arc/mm/cache.c:1013:59: note: expected 'long unsigned int' but argument is of type 'void *' + void __flush_dcache_page(phys_addr_t paddr, unsigned long vaddr) + ~~~~~~~~~~~~~~^~~~~ + +Signed-off-by: Randy Dunlap +Cc: Vineet Gupta +Cc: linux-snps-arc@lists.infradead.org +Cc: Elad Kanfi +Cc: Leon Romanovsky +Cc: Ofer Levi +Signed-off-by: Vineet Gupta +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + arch/arc/mm/cache.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +--- a/arch/arc/mm/cache.c ++++ b/arch/arc/mm/cache.c +@@ -840,7 +840,7 @@ void flush_cache_mm(struct mm_struct *mm + void flush_cache_page(struct vm_area_struct *vma, unsigned long u_vaddr, + unsigned long pfn) + { +- unsigned int paddr = pfn << PAGE_SHIFT; ++ phys_addr_t paddr = pfn << PAGE_SHIFT; + + u_vaddr &= PAGE_MASK; + +@@ -860,8 +860,9 @@ void flush_anon_page(struct vm_area_stru + unsigned long u_vaddr) + { + /* TBD: do we really need to clear the kernel mapping */ +- __flush_dcache_page(page_address(page), u_vaddr); +- __flush_dcache_page(page_address(page), page_address(page)); ++ __flush_dcache_page((phys_addr_t)page_address(page), u_vaddr); ++ __flush_dcache_page((phys_addr_t)page_address(page), ++ (phys_addr_t)page_address(page)); + + } + diff --git a/queue-4.9/atl1c-reserve-min-skb-headroom.patch b/queue-4.9/atl1c-reserve-min-skb-headroom.patch new file mode 100644 index 00000000000..5b570587bb9 --- /dev/null +++ b/queue-4.9/atl1c-reserve-min-skb-headroom.patch @@ -0,0 +1,51 @@ +From foo@baz Sun Aug 26 09:16:12 CEST 2018 +From: Florian Westphal +Date: Fri, 20 Jul 2018 19:30:57 +0200 +Subject: atl1c: reserve min skb headroom + +From: Florian Westphal + +[ Upstream commit 6e56830776828d8ca9897fc4429eeab47c3bb432 ] + +Got crash report with following backtrace: +BUG: unable to handle kernel paging request at ffff8801869daffe +RIP: 0010:[] [] ip6_finish_output2+0x394/0x4c0 +RSP: 0018:ffff880186c83a98 EFLAGS: 00010283 +RAX: ffff8801869db00e ... + [] ip6_finish_output+0x8c/0xf0 + [] ip6_output+0x57/0x100 + [] ip6_forward+0x4b9/0x840 + [] ip6_rcv_finish+0x66/0xc0 + [] ipv6_rcv+0x319/0x530 + [] netif_receive_skb+0x1c/0x70 + [] atl1c_clean+0x1ec/0x310 [atl1c] + ... + +The bad access is in neigh_hh_output(), at skb->data - 16 (HH_DATA_MOD). +atl1c driver provided skb with no headroom, so 14 bytes (ethernet +header) got pulled, but then 16 are copied. + +Reserve NET_SKB_PAD bytes headroom, like netdev_alloc_skb(). + +Compile tested only; I lack hardware. + +Fixes: 7b7017642199 ("atl1c: Fix misuse of netdev_alloc_skb in refilling rx ring") +Signed-off-by: Florian Westphal +Reviewed-by: Eric Dumazet +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/ethernet/atheros/atl1c/atl1c_main.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c ++++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c +@@ -1678,6 +1678,7 @@ static struct sk_buff *atl1c_alloc_skb(s + skb = build_skb(page_address(page) + adapter->rx_page_offset, + adapter->rx_frag_size); + if (likely(skb)) { ++ skb_reserve(skb, NET_SKB_PAD); + adapter->rx_page_offset += adapter->rx_frag_size; + if (adapter->rx_page_offset >= PAGE_SIZE) + adapter->rx_page = NULL; diff --git a/queue-4.9/bnx2x-fix-invalid-memory-access-in-rss-hash-config-path.patch b/queue-4.9/bnx2x-fix-invalid-memory-access-in-rss-hash-config-path.patch new file mode 100644 index 00000000000..f2daaca44f7 --- /dev/null +++ b/queue-4.9/bnx2x-fix-invalid-memory-access-in-rss-hash-config-path.patch @@ -0,0 +1,61 @@ +From foo@baz Sun Aug 26 09:16:12 CEST 2018 +From: Sudarsana Reddy Kalluru +Date: Tue, 24 Jul 2018 02:43:52 -0700 +Subject: bnx2x: Fix invalid memory access in rss hash config path. + +From: Sudarsana Reddy Kalluru + +[ Upstream commit ae2dcb28c24794a87e424a726a1cf1a61980f52d ] + +Rx hash/filter table configuration uses rss_conf_obj to configure filters +in the hardware. This object is initialized only when the interface is +brought up. +This patch adds driver changes to configure rss params only when the device +is in opened state. In port disabled case, the config will be cached in the +driver structure which will be applied in the successive load path. + +Please consider applying it to 'net' branch. + +Signed-off-by: Sudarsana Reddy Kalluru +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c | 13 ++++++++++--- + 1 file changed, 10 insertions(+), 3 deletions(-) + +--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c ++++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c +@@ -3367,14 +3367,18 @@ static int bnx2x_set_rss_flags(struct bn + DP(BNX2X_MSG_ETHTOOL, + "rss re-configured, UDP 4-tupple %s\n", + udp_rss_requested ? "enabled" : "disabled"); +- return bnx2x_rss(bp, &bp->rss_conf_obj, false, true); ++ if (bp->state == BNX2X_STATE_OPEN) ++ return bnx2x_rss(bp, &bp->rss_conf_obj, false, ++ true); + } else if ((info->flow_type == UDP_V6_FLOW) && + (bp->rss_conf_obj.udp_rss_v6 != udp_rss_requested)) { + bp->rss_conf_obj.udp_rss_v6 = udp_rss_requested; + DP(BNX2X_MSG_ETHTOOL, + "rss re-configured, UDP 4-tupple %s\n", + udp_rss_requested ? "enabled" : "disabled"); +- return bnx2x_rss(bp, &bp->rss_conf_obj, false, true); ++ if (bp->state == BNX2X_STATE_OPEN) ++ return bnx2x_rss(bp, &bp->rss_conf_obj, false, ++ true); + } + return 0; + +@@ -3488,7 +3492,10 @@ static int bnx2x_set_rxfh(struct net_dev + bp->rss_conf_obj.ind_table[i] = indir[i] + bp->fp->cl_id; + } + +- return bnx2x_config_rss_eth(bp, false); ++ if (bp->state == BNX2X_STATE_OPEN) ++ return bnx2x_config_rss_eth(bp, false); ++ ++ return 0; + } + + /** diff --git a/queue-4.9/bpf-ppc64-fix-unexpected-r0-0-exit-path-inside-bpf_xadd.patch b/queue-4.9/bpf-ppc64-fix-unexpected-r0-0-exit-path-inside-bpf_xadd.patch new file mode 100644 index 00000000000..c3692b87f82 --- /dev/null +++ b/queue-4.9/bpf-ppc64-fix-unexpected-r0-0-exit-path-inside-bpf_xadd.patch @@ -0,0 +1,97 @@ +From foo@baz Sun Aug 26 09:16:12 CEST 2018 +From: Daniel Borkmann +Date: Thu, 19 Jul 2018 18:18:35 +0200 +Subject: bpf, ppc64: fix unexpected r0=0 exit path inside bpf_xadd + +From: Daniel Borkmann + +[ Upstream commit b9c1e60e7bf4e64ac1b4f4d6d593f0bb57886973 ] + +None of the JITs is allowed to implement exit paths from the BPF +insn mappings other than BPF_JMP | BPF_EXIT. In the BPF core code +we have a couple of rewrites in eBPF (e.g. LD_ABS / LD_IND) and +in eBPF to cBPF translation to retain old existing behavior where +exceptions may occur; they are also tightly controlled by the +verifier where it disallows some of the features such as BPF to +BPF calls when legacy LD_ABS / LD_IND ops are present in the BPF +program. During recent review of all BPF_XADD JIT implementations +I noticed that the ppc64 one is buggy in that it contains two +jumps to exit paths. This is problematic as this can bypass verifier +expectations e.g. pointed out in commit f6b1b3bf0d5f ("bpf: fix +subprog verifier bypass by div/mod by 0 exception"). The first +exit path is obsoleted by the fix in ca36960211eb ("bpf: allow xadd +only on aligned memory") anyway, and for the second one we need to +do a fetch, add and store loop if the reservation from lwarx/ldarx +was lost in the meantime. + +Fixes: 156d0e290e96 ("powerpc/ebpf/jit: Implement JIT compiler for extended BPF") +Reviewed-by: Naveen N. Rao +Reviewed-by: Sandipan Das +Tested-by: Sandipan Das +Signed-off-by: Daniel Borkmann +Signed-off-by: Alexei Starovoitov +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + arch/powerpc/net/bpf_jit_comp64.c | 29 +++++------------------------ + 1 file changed, 5 insertions(+), 24 deletions(-) + +--- a/arch/powerpc/net/bpf_jit_comp64.c ++++ b/arch/powerpc/net/bpf_jit_comp64.c +@@ -326,6 +326,7 @@ static int bpf_jit_build_body(struct bpf + u64 imm64; + u8 *func; + u32 true_cond; ++ u32 tmp_idx; + + /* + * addrs[] maps a BPF bytecode address into a real offset from +@@ -685,11 +686,7 @@ emit_clear: + case BPF_STX | BPF_XADD | BPF_W: + /* Get EA into TMP_REG_1 */ + PPC_ADDI(b2p[TMP_REG_1], dst_reg, off); +- /* error if EA is not word-aligned */ +- PPC_ANDI(b2p[TMP_REG_2], b2p[TMP_REG_1], 0x03); +- PPC_BCC_SHORT(COND_EQ, (ctx->idx * 4) + 12); +- PPC_LI(b2p[BPF_REG_0], 0); +- PPC_JMP(exit_addr); ++ tmp_idx = ctx->idx * 4; + /* load value from memory into TMP_REG_2 */ + PPC_BPF_LWARX(b2p[TMP_REG_2], 0, b2p[TMP_REG_1], 0); + /* add value from src_reg into this */ +@@ -697,32 +694,16 @@ emit_clear: + /* store result back */ + PPC_BPF_STWCX(b2p[TMP_REG_2], 0, b2p[TMP_REG_1]); + /* we're done if this succeeded */ +- PPC_BCC_SHORT(COND_EQ, (ctx->idx * 4) + (7*4)); +- /* otherwise, let's try once more */ +- PPC_BPF_LWARX(b2p[TMP_REG_2], 0, b2p[TMP_REG_1], 0); +- PPC_ADD(b2p[TMP_REG_2], b2p[TMP_REG_2], src_reg); +- PPC_BPF_STWCX(b2p[TMP_REG_2], 0, b2p[TMP_REG_1]); +- /* exit if the store was not successful */ +- PPC_LI(b2p[BPF_REG_0], 0); +- PPC_BCC(COND_NE, exit_addr); ++ PPC_BCC_SHORT(COND_NE, tmp_idx); + break; + /* *(u64 *)(dst + off) += src */ + case BPF_STX | BPF_XADD | BPF_DW: + PPC_ADDI(b2p[TMP_REG_1], dst_reg, off); +- /* error if EA is not doubleword-aligned */ +- PPC_ANDI(b2p[TMP_REG_2], b2p[TMP_REG_1], 0x07); +- PPC_BCC_SHORT(COND_EQ, (ctx->idx * 4) + (3*4)); +- PPC_LI(b2p[BPF_REG_0], 0); +- PPC_JMP(exit_addr); +- PPC_BPF_LDARX(b2p[TMP_REG_2], 0, b2p[TMP_REG_1], 0); +- PPC_ADD(b2p[TMP_REG_2], b2p[TMP_REG_2], src_reg); +- PPC_BPF_STDCX(b2p[TMP_REG_2], 0, b2p[TMP_REG_1]); +- PPC_BCC_SHORT(COND_EQ, (ctx->idx * 4) + (7*4)); ++ tmp_idx = ctx->idx * 4; + PPC_BPF_LDARX(b2p[TMP_REG_2], 0, b2p[TMP_REG_1], 0); + PPC_ADD(b2p[TMP_REG_2], b2p[TMP_REG_2], src_reg); + PPC_BPF_STDCX(b2p[TMP_REG_2], 0, b2p[TMP_REG_1]); +- PPC_LI(b2p[BPF_REG_0], 0); +- PPC_BCC(COND_NE, exit_addr); ++ PPC_BCC_SHORT(COND_NE, tmp_idx); + break; + + /* diff --git a/queue-4.9/cachefiles-fix-refcounting-bug-in-backing-file-read-monitoring.patch b/queue-4.9/cachefiles-fix-refcounting-bug-in-backing-file-read-monitoring.patch new file mode 100644 index 00000000000..58b96aecca5 --- /dev/null +++ b/queue-4.9/cachefiles-fix-refcounting-bug-in-backing-file-read-monitoring.patch @@ -0,0 +1,118 @@ +From foo@baz Sun Aug 26 09:16:12 CEST 2018 +From: Kiran Kumar Modukuri +Date: Tue, 18 Jul 2017 16:25:49 -0700 +Subject: cachefiles: Fix refcounting bug in backing-file read monitoring + +From: Kiran Kumar Modukuri + +[ Upstream commit 934140ab028713a61de8bca58c05332416d037d1 ] + +cachefiles_read_waiter() has the right to access a 'monitor' object by +virtue of being called under the waitqueue lock for one of the pages in its +purview. However, it has no ref on that monitor object or on the +associated operation. + +What it is allowed to do is to move the monitor object to the operation's +to_do list, but once it drops the work_lock, it's actually no longer +permitted to access that object. However, it is trying to enqueue the +retrieval operation for processing - but it can only do this via a pointer +in the monitor object, something it shouldn't be doing. + +If it doesn't enqueue the operation, the operation may not get processed. +If the order is flipped so that the enqueue is first, then it's possible +for the work processor to look at the to_do list before the monitor is +enqueued upon it. + +Fix this by getting a ref on the operation so that we can trust that it +will still be there once we've added the monitor to the to_do list and +dropped the work_lock. The op can then be enqueued after the lock is +dropped. + +The bug can manifest in one of a couple of ways. The first manifestation +looks like: + + FS-Cache: + FS-Cache: Assertion failed + FS-Cache: 6 == 5 is false + ------------[ cut here ]------------ + kernel BUG at fs/fscache/operation.c:494! + RIP: 0010:fscache_put_operation+0x1e3/0x1f0 + ... + fscache_op_work_func+0x26/0x50 + process_one_work+0x131/0x290 + worker_thread+0x45/0x360 + kthread+0xf8/0x130 + ? create_worker+0x190/0x190 + ? kthread_cancel_work_sync+0x10/0x10 + ret_from_fork+0x1f/0x30 + +This is due to the operation being in the DEAD state (6) rather than +INITIALISED, COMPLETE or CANCELLED (5) because it's already passed through +fscache_put_operation(). + +The bug can also manifest like the following: + + kernel BUG at fs/fscache/operation.c:69! + ... + [exception RIP: fscache_enqueue_operation+246] + ... + #7 [ffff883fff083c10] fscache_enqueue_operation at ffffffffa0b793c6 + #8 [ffff883fff083c28] cachefiles_read_waiter at ffffffffa0b15a48 + #9 [ffff883fff083c48] __wake_up_common at ffffffff810af028 + +I'm not entirely certain as to which is line 69 in Lei's kernel, so I'm not +entirely clear which assertion failed. + +Fixes: 9ae326a69004 ("CacheFiles: A cache that backs onto a mounted filesystem") +Reported-by: Lei Xue +Reported-by: Vegard Nossum +Reported-by: Anthony DeRobertis +Reported-by: NeilBrown +Reported-by: Daniel Axtens +Reported-by: Kiran Kumar Modukuri +Signed-off-by: David Howells +Reviewed-by: Daniel Axtens +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + fs/cachefiles/rdwr.c | 17 ++++++++++++----- + 1 file changed, 12 insertions(+), 5 deletions(-) + +--- a/fs/cachefiles/rdwr.c ++++ b/fs/cachefiles/rdwr.c +@@ -27,6 +27,7 @@ static int cachefiles_read_waiter(wait_q + struct cachefiles_one_read *monitor = + container_of(wait, struct cachefiles_one_read, monitor); + struct cachefiles_object *object; ++ struct fscache_retrieval *op = monitor->op; + struct wait_bit_key *key = _key; + struct page *page = wait->private; + +@@ -51,16 +52,22 @@ static int cachefiles_read_waiter(wait_q + list_del(&wait->task_list); + + /* move onto the action list and queue for FS-Cache thread pool */ +- ASSERT(monitor->op); ++ ASSERT(op); + +- object = container_of(monitor->op->op.object, +- struct cachefiles_object, fscache); ++ /* We need to temporarily bump the usage count as we don't own a ref ++ * here otherwise cachefiles_read_copier() may free the op between the ++ * monitor being enqueued on the op->to_do list and the op getting ++ * enqueued on the work queue. ++ */ ++ fscache_get_retrieval(op); + ++ object = container_of(op->op.object, struct cachefiles_object, fscache); + spin_lock(&object->work_lock); +- list_add_tail(&monitor->op_link, &monitor->op->to_do); ++ list_add_tail(&monitor->op_link, &op->to_do); + spin_unlock(&object->work_lock); + +- fscache_enqueue_retrieval(monitor->op); ++ fscache_enqueue_retrieval(op); ++ fscache_put_retrieval(op); + return 0; + } + diff --git a/queue-4.9/cachefiles-wait-rather-than-bug-ing-on-unexpected-object-collision.patch b/queue-4.9/cachefiles-wait-rather-than-bug-ing-on-unexpected-object-collision.patch new file mode 100644 index 00000000000..e18a3c49274 --- /dev/null +++ b/queue-4.9/cachefiles-wait-rather-than-bug-ing-on-unexpected-object-collision.patch @@ -0,0 +1,37 @@ +From foo@baz Sun Aug 26 09:16:12 CEST 2018 +From: Kiran Kumar Modukuri +Date: Thu, 21 Jun 2018 13:25:53 -0700 +Subject: cachefiles: Wait rather than BUG'ing on "Unexpected object collision" + +From: Kiran Kumar Modukuri + +[ Upstream commit c2412ac45a8f8f1cd582723c1a139608694d410d ] + +If we meet a conflicting object that is marked FSCACHE_OBJECT_IS_LIVE in +the active object tree, we have been emitting a BUG after logging +information about it and the new object. + +Instead, we should wait for the CACHEFILES_OBJECT_ACTIVE flag to be cleared +on the old object (or return an error). The ACTIVE flag should be cleared +after it has been removed from the active object tree. A timeout of 60s is +used in the wait, so we shouldn't be able to get stuck there. + +Fixes: 9ae326a69004 ("CacheFiles: A cache that backs onto a mounted filesystem") +Signed-off-by: Kiran Kumar Modukuri +Signed-off-by: David Howells +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + fs/cachefiles/namei.c | 1 - + 1 file changed, 1 deletion(-) + +--- a/fs/cachefiles/namei.c ++++ b/fs/cachefiles/namei.c +@@ -195,7 +195,6 @@ wait_for_old_object: + pr_err("\n"); + pr_err("Error: Unexpected object collision\n"); + cachefiles_printk_object(object, xobject); +- BUG(); + } + atomic_inc(&xobject->usage); + write_unlock(&cache->active_lock); diff --git a/queue-4.9/can-mpc5xxx_can-check-of_iomap-return-before-use.patch b/queue-4.9/can-mpc5xxx_can-check-of_iomap-return-before-use.patch new file mode 100644 index 00000000000..92b48483a68 --- /dev/null +++ b/queue-4.9/can-mpc5xxx_can-check-of_iomap-return-before-use.patch @@ -0,0 +1,36 @@ +From foo@baz Sun Aug 26 09:16:12 CEST 2018 +From: Nicholas Mc Guire +Date: Mon, 9 Jul 2018 21:16:40 +0200 +Subject: can: mpc5xxx_can: check of_iomap return before use + +From: Nicholas Mc Guire + +[ Upstream commit b5c1a23b17e563b656cc9bb76ce5323b997d90e8 ] + +of_iomap() can return NULL so that return needs to be checked and NULL +treated as failure. While at it also take care of the missing +of_node_put() in the error path. + +Signed-off-by: Nicholas Mc Guire +Fixes: commit afa17a500a36 ("net/can: add driver for mscan family & mpc52xx_mscan") +Signed-off-by: Marc Kleine-Budde +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/can/mscan/mpc5xxx_can.c | 5 +++++ + 1 file changed, 5 insertions(+) + +--- a/drivers/net/can/mscan/mpc5xxx_can.c ++++ b/drivers/net/can/mscan/mpc5xxx_can.c +@@ -86,6 +86,11 @@ static u32 mpc52xx_can_get_clock(struct + return 0; + } + cdm = of_iomap(np_cdm, 0); ++ if (!cdm) { ++ of_node_put(np_cdm); ++ dev_err(&ofdev->dev, "can't map clock node!\n"); ++ return 0; ++ } + + if (in_8(&cdm->ipb_clk_sel) & 0x1) + freq *= 2; diff --git a/queue-4.9/drivers-net-lmc-fix-case-value-for-target-abort-error.patch b/queue-4.9/drivers-net-lmc-fix-case-value-for-target-abort-error.patch new file mode 100644 index 00000000000..7b99c40a85f --- /dev/null +++ b/queue-4.9/drivers-net-lmc-fix-case-value-for-target-abort-error.patch @@ -0,0 +1,35 @@ +From foo@baz Sun Aug 26 09:16:12 CEST 2018 +From: Colin Ian King +Date: Wed, 1 Aug 2018 18:22:41 +0100 +Subject: drivers: net: lmc: fix case value for target abort error + +From: Colin Ian King + +[ Upstream commit afb41bb039656f0cecb54eeb8b2e2088201295f5 ] + +Current value for a target abort error is 0x010, however, this value +should in fact be 0x002. As it stands, the range of error is 0..7 so +it is currently never being detected. This bug has been in the driver +since the early 2.6.12 days (or before). + +Detected by CoverityScan, CID#744290 ("Logically dead code") + +Signed-off-by: Colin Ian King +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/wan/lmc/lmc_main.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/wan/lmc/lmc_main.c ++++ b/drivers/net/wan/lmc/lmc_main.c +@@ -1372,7 +1372,7 @@ static irqreturn_t lmc_interrupt (int ir + case 0x001: + printk(KERN_WARNING "%s: Master Abort (naughty)\n", dev->name); + break; +- case 0x010: ++ case 0x002: + printk(KERN_WARNING "%s: Target Abort (not so naughty)\n", dev->name); + break; + default: diff --git a/queue-4.9/drm-bridge-adv7511-reset-registers-on-hotplug.patch b/queue-4.9/drm-bridge-adv7511-reset-registers-on-hotplug.patch new file mode 100644 index 00000000000..c1a1de99d87 --- /dev/null +++ b/queue-4.9/drm-bridge-adv7511-reset-registers-on-hotplug.patch @@ -0,0 +1,44 @@ +From foo@baz Sun Aug 26 09:16:12 CEST 2018 +From: Sean Paul +Date: Tue, 3 Jul 2018 12:56:03 -0400 +Subject: drm/bridge: adv7511: Reset registers on hotplug + +From: Sean Paul + +[ Upstream commit 5f3417569165a8ee57654217f73e0160312f409c ] + +The bridge loses its hw state when the cable is unplugged. If we detect +this case in the hpd handler, reset its state. + +Reported-by: Rob Clark +Tested-by: Rob Clark +Reviewed-by: Archit Taneja +Signed-off-by: Sean Paul +Link: https://patchwork.freedesktop.org/patch/msgid/20180703165648.120401-1-seanpaul@chromium.org +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +--- a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c ++++ b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +@@ -424,6 +424,18 @@ static void adv7511_hpd_work(struct work + else + status = connector_status_disconnected; + ++ /* ++ * The bridge resets its registers on unplug. So when we get a plug ++ * event and we're already supposed to be powered, cycle the bridge to ++ * restore its state. ++ */ ++ if (status == connector_status_connected && ++ adv7511->connector.status == connector_status_disconnected && ++ adv7511->powered) { ++ regcache_mark_dirty(adv7511->regmap); ++ adv7511_power_on(adv7511); ++ } ++ + if (adv7511->connector.status != status) { + adv7511->connector.status = status; + drm_kms_helper_hotplug_event(adv7511->connector.dev); diff --git a/queue-4.9/drm-imx-imx-ldb-check-if-channel-is-enabled-before-printing-warning.patch b/queue-4.9/drm-imx-imx-ldb-check-if-channel-is-enabled-before-printing-warning.patch new file mode 100644 index 00000000000..a6279440068 --- /dev/null +++ b/queue-4.9/drm-imx-imx-ldb-check-if-channel-is-enabled-before-printing-warning.patch @@ -0,0 +1,40 @@ +From foo@baz Sun Aug 26 09:16:12 CEST 2018 +From: Lucas Stach +Date: Wed, 11 Apr 2018 17:31:36 +0200 +Subject: drm/imx: imx-ldb: check if channel is enabled before printing warning + +From: Lucas Stach + +[ Upstream commit c80d673b91a6c81d765864e10f2b15110ee900ad ] + +If the second LVDS channel has been disabled in the DT when using dual-channel +mode we should not print a warning. + +Signed-off-by: Lucas Stach +Signed-off-by: Philipp Zabel +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/imx/imx-ldb.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +--- a/drivers/gpu/drm/imx/imx-ldb.c ++++ b/drivers/gpu/drm/imx/imx-ldb.c +@@ -678,14 +678,14 @@ static int imx_ldb_bind(struct device *d + if (ret || i < 0 || i > 1) + return -EINVAL; + ++ if (!of_device_is_available(child)) ++ continue; ++ + if (dual && i > 0) { + dev_warn(dev, "dual-channel mode, ignoring second output\n"); + continue; + } + +- if (!of_device_is_available(child)) +- continue; +- + channel = &imx_ldb->channel[i]; + channel->ldb = imx_ldb; + channel->chno = i; diff --git a/queue-4.9/drm-imx-imx-ldb-disable-ldb-on-driver-bind.patch b/queue-4.9/drm-imx-imx-ldb-disable-ldb-on-driver-bind.patch new file mode 100644 index 00000000000..19ffa13159a --- /dev/null +++ b/queue-4.9/drm-imx-imx-ldb-disable-ldb-on-driver-bind.patch @@ -0,0 +1,40 @@ +From foo@baz Sun Aug 26 09:16:12 CEST 2018 +From: Lucas Stach +Date: Wed, 11 Apr 2018 17:31:35 +0200 +Subject: drm/imx: imx-ldb: disable LDB on driver bind + +From: Lucas Stach + +[ Upstream commit b58262396fabd43dc869b576e3defdd23b32fe94 ] + +The LVDS signal integrity is only guaranteed when the correct enable +sequence (first IPU DI, then LDB) is used. If the LDB display output was +active before the imx-drm driver is loaded (like when a bootsplash was +active) the DI will be disabled by the full IPU reset we do when loading +the driver. The LDB control registers are not part of the IPU range and +thus will remain unchanged. + +This leads to the LDB still being active when the DI is getting enabled, +effectively reversing the required enable sequence. Fix this by also +disabling the LDB on driver bind. + +Signed-off-by: Lucas Stach +Signed-off-by: Philipp Zabel +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/imx/imx-ldb.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/drivers/gpu/drm/imx/imx-ldb.c ++++ b/drivers/gpu/drm/imx/imx-ldb.c +@@ -634,6 +634,9 @@ static int imx_ldb_bind(struct device *d + return PTR_ERR(imx_ldb->regmap); + } + ++ /* disable LDB by resetting the control register to POR default */ ++ regmap_write(imx_ldb->regmap, IOMUXC_GPR2, 0); ++ + imx_ldb->dev = dev; + + if (of_id) diff --git a/queue-4.9/drm-re-enable-error-handling.patch b/queue-4.9/drm-re-enable-error-handling.patch new file mode 100644 index 00000000000..cf2982dee71 --- /dev/null +++ b/queue-4.9/drm-re-enable-error-handling.patch @@ -0,0 +1,36 @@ +From foo@baz Sun Aug 26 09:16:12 CEST 2018 +From: Nicholas Mc Guire +Date: Sat, 14 Jul 2018 14:32:12 +0200 +Subject: drm: re-enable error handling + +From: Nicholas Mc Guire + +[ Upstream commit d530b5f1ca0bb66958a2b714bebe40a1248b9c15 ] + +drm_legacy_ctxbitmap_next() returns idr_alloc() which can return +-ENOMEM, -EINVAL or -ENOSPC none of which are -1 . but the call sites +of drm_legacy_ctxbitmap_next() seem to be assuming that the error case +would be -1 (original return of drm_ctxbitmap_next() prior to 2.6.23 +was actually -1). Thus reenable error handling by checking for < 0. + +Signed-off-by: Nicholas Mc Guire +Fixes: 62968144e673 ("drm: convert drm context code to use Linux idr") +Signed-off-by: Sean Paul +Link: https://patchwork.freedesktop.org/patch/msgid/1531571532-22733-1-git-send-email-hofrat@osadl.org +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/drm_context.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/gpu/drm/drm_context.c ++++ b/drivers/gpu/drm/drm_context.c +@@ -372,7 +372,7 @@ int drm_legacy_addctx(struct drm_device + ctx->handle = drm_legacy_ctxbitmap_next(dev); + } + DRM_DEBUG("%d\n", ctx->handle); +- if (ctx->handle == -1) { ++ if (ctx->handle < 0) { + DRM_DEBUG("Not enough free contexts.\n"); + /* Should this return -EBUSY instead? */ + return -ENOMEM; diff --git a/queue-4.9/enic-handle-mtu-change-for-vf-properly.patch b/queue-4.9/enic-handle-mtu-change-for-vf-properly.patch new file mode 100644 index 00000000000..c197d5f734f --- /dev/null +++ b/queue-4.9/enic-handle-mtu-change-for-vf-properly.patch @@ -0,0 +1,131 @@ +From foo@baz Sun Aug 26 09:16:12 CEST 2018 +From: Govindarajulu Varadarajan +Date: Fri, 27 Jul 2018 11:19:29 -0700 +Subject: enic: handle mtu change for vf properly + +From: Govindarajulu Varadarajan + +[ Upstream commit ab123fe071c9aa9680ecd62eb080eb26cff4892c ] + +When driver gets notification for mtu change, driver does not handle it for +all RQs. It handles only RQ[0]. + +Fix is to use enic_change_mtu() interface to change mtu for vf. + +Signed-off-by: Govindarajulu Varadarajan +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/ethernet/cisco/enic/enic_main.c | 78 +++++++++------------------- + 1 file changed, 27 insertions(+), 51 deletions(-) + +--- a/drivers/net/ethernet/cisco/enic/enic_main.c ++++ b/drivers/net/ethernet/cisco/enic/enic_main.c +@@ -1842,10 +1842,32 @@ static int enic_stop(struct net_device * + return 0; + } + ++static int _enic_change_mtu(struct net_device *netdev, int new_mtu) ++{ ++ bool running = netif_running(netdev); ++ int err = 0; ++ ++ ASSERT_RTNL(); ++ if (running) { ++ err = enic_stop(netdev); ++ if (err) ++ return err; ++ } ++ ++ netdev->mtu = new_mtu; ++ ++ if (running) { ++ err = enic_open(netdev); ++ if (err) ++ return err; ++ } ++ ++ return 0; ++} ++ + static int enic_change_mtu(struct net_device *netdev, int new_mtu) + { + struct enic *enic = netdev_priv(netdev); +- int running = netif_running(netdev); + + if (new_mtu < ENIC_MIN_MTU || new_mtu > ENIC_MAX_MTU) + return -EINVAL; +@@ -1853,20 +1875,12 @@ static int enic_change_mtu(struct net_de + if (enic_is_dynamic(enic) || enic_is_sriov_vf(enic)) + return -EOPNOTSUPP; + +- if (running) +- enic_stop(netdev); +- +- netdev->mtu = new_mtu; +- + if (netdev->mtu > enic->port_mtu) + netdev_warn(netdev, +- "interface MTU (%d) set higher than port MTU (%d)\n", +- netdev->mtu, enic->port_mtu); +- +- if (running) +- enic_open(netdev); ++ "interface MTU (%d) set higher than port MTU (%d)\n", ++ netdev->mtu, enic->port_mtu); + +- return 0; ++ return _enic_change_mtu(netdev, new_mtu); + } + + static void enic_change_mtu_work(struct work_struct *work) +@@ -1874,47 +1888,9 @@ static void enic_change_mtu_work(struct + struct enic *enic = container_of(work, struct enic, change_mtu_work); + struct net_device *netdev = enic->netdev; + int new_mtu = vnic_dev_mtu(enic->vdev); +- int err; +- unsigned int i; +- +- new_mtu = max_t(int, ENIC_MIN_MTU, min_t(int, ENIC_MAX_MTU, new_mtu)); + + rtnl_lock(); +- +- /* Stop RQ */ +- del_timer_sync(&enic->notify_timer); +- +- for (i = 0; i < enic->rq_count; i++) +- napi_disable(&enic->napi[i]); +- +- vnic_intr_mask(&enic->intr[0]); +- enic_synchronize_irqs(enic); +- err = vnic_rq_disable(&enic->rq[0]); +- if (err) { +- rtnl_unlock(); +- netdev_err(netdev, "Unable to disable RQ.\n"); +- return; +- } +- vnic_rq_clean(&enic->rq[0], enic_free_rq_buf); +- vnic_cq_clean(&enic->cq[0]); +- vnic_intr_clean(&enic->intr[0]); +- +- /* Fill RQ with new_mtu-sized buffers */ +- netdev->mtu = new_mtu; +- vnic_rq_fill(&enic->rq[0], enic_rq_alloc_buf); +- /* Need at least one buffer on ring to get going */ +- if (vnic_rq_desc_used(&enic->rq[0]) == 0) { +- rtnl_unlock(); +- netdev_err(netdev, "Unable to alloc receive buffers.\n"); +- return; +- } +- +- /* Start RQ */ +- vnic_rq_enable(&enic->rq[0]); +- napi_enable(&enic->napi[0]); +- vnic_intr_unmask(&enic->intr[0]); +- enic_notify_timer_start(enic); +- ++ (void)_enic_change_mtu(netdev, new_mtu); + rtnl_unlock(); + + netdev_info(netdev, "interface MTU set as %d\n", netdev->mtu); diff --git a/queue-4.9/fscache-allow-cancelled-operations-to-be-enqueued.patch b/queue-4.9/fscache-allow-cancelled-operations-to-be-enqueued.patch new file mode 100644 index 00000000000..dd5b8614a04 --- /dev/null +++ b/queue-4.9/fscache-allow-cancelled-operations-to-be-enqueued.patch @@ -0,0 +1,46 @@ +From foo@baz Sun Aug 26 09:16:12 CEST 2018 +From: Kiran Kumar Modukuri +Date: Wed, 25 Jul 2018 14:31:20 +0100 +Subject: fscache: Allow cancelled operations to be enqueued + +From: Kiran Kumar Modukuri + +[ Upstream commit d0eb06afe712b7b103b6361f40a9a0c638524669 ] + +Alter the state-check assertion in fscache_enqueue_operation() to allow +cancelled operations to be given processing time so they can be cleaned up. + +Also fix a debugging statement that was requiring such operations to have +an object assigned. + +Fixes: 9ae326a69004 ("CacheFiles: A cache that backs onto a mounted filesystem") +Reported-by: Kiran Kumar Modukuri +Signed-off-by: David Howells +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + fs/fscache/operation.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +--- a/fs/fscache/operation.c ++++ b/fs/fscache/operation.c +@@ -66,7 +66,8 @@ void fscache_enqueue_operation(struct fs + ASSERT(op->processor != NULL); + ASSERT(fscache_object_is_available(op->object)); + ASSERTCMP(atomic_read(&op->usage), >, 0); +- ASSERTCMP(op->state, ==, FSCACHE_OP_ST_IN_PROGRESS); ++ ASSERTIFCMP(op->state != FSCACHE_OP_ST_IN_PROGRESS, ++ op->state, ==, FSCACHE_OP_ST_CANCELLED); + + fscache_stat(&fscache_n_op_enqueue); + switch (op->flags & FSCACHE_OP_TYPE) { +@@ -481,7 +482,8 @@ void fscache_put_operation(struct fscach + struct fscache_cache *cache; + + _enter("{OBJ%x OP%x,%d}", +- op->object->debug_id, op->debug_id, atomic_read(&op->usage)); ++ op->object ? op->object->debug_id : 0, ++ op->debug_id, atomic_read(&op->usage)); + + ASSERTCMP(atomic_read(&op->usage), >, 0); + diff --git a/queue-4.9/i2c-davinci-avoid-zero-value-of-clkh.patch b/queue-4.9/i2c-davinci-avoid-zero-value-of-clkh.patch new file mode 100644 index 00000000000..4049687bc23 --- /dev/null +++ b/queue-4.9/i2c-davinci-avoid-zero-value-of-clkh.patch @@ -0,0 +1,42 @@ +From foo@baz Sun Aug 26 09:16:12 CEST 2018 +From: Alexander Sverdlin +Date: Fri, 13 Jul 2018 17:20:17 +0200 +Subject: i2c: davinci: Avoid zero value of CLKH + +From: Alexander Sverdlin + +[ Upstream commit cc8de9a68599b261244ea453b38678229f06ada7 ] + +If CLKH is set to 0 I2C clock is not generated at all, so avoid this value +and stretch the clock in this case. + +Signed-off-by: Alexander Sverdlin +Acked-by: Sekhar Nori +Signed-off-by: Wolfram Sang +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/i2c/busses/i2c-davinci.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +--- a/drivers/i2c/busses/i2c-davinci.c ++++ b/drivers/i2c/busses/i2c-davinci.c +@@ -234,12 +234,16 @@ static void i2c_davinci_calc_clk_divider + /* + * It's not always possible to have 1 to 2 ratio when d=7, so fall back + * to minimal possible clkh in this case. ++ * ++ * Note: ++ * CLKH is not allowed to be 0, in this case I2C clock is not generated ++ * at all + */ +- if (clk >= clkl + d) { ++ if (clk > clkl + d) { + clkh = clk - clkl - d; + clkl -= d; + } else { +- clkh = 0; ++ clkh = 1; + clkl = clk - (d << 1); + } + diff --git a/queue-4.9/mac80211-add-stations-tied-to-ap_vlans-during-hw-reconfig.patch b/queue-4.9/mac80211-add-stations-tied-to-ap_vlans-during-hw-reconfig.patch new file mode 100644 index 00000000000..3e5de8b7639 --- /dev/null +++ b/queue-4.9/mac80211-add-stations-tied-to-ap_vlans-during-hw-reconfig.patch @@ -0,0 +1,80 @@ +From foo@baz Sun Aug 26 09:16:12 CEST 2018 +From: "mpubbise@codeaurora.org" +Date: Mon, 2 Jul 2018 15:40:14 +0530 +Subject: mac80211: add stations tied to AP_VLANs during hw reconfig + +From: "mpubbise@codeaurora.org" + +[ Upstream commit 19103a4bfb42f320395daa5616ece3e89e759d63 ] + +As part of hw reconfig, only stations linked to AP interfaces are added +back to the driver ignoring those which are tied to AP_VLAN interfaces. + +It is true that there could be stations tied to the AP_VLAN interface while +serving 4addr clients or when using AP_VLAN for VLAN operations; we should +be adding these stations back to the driver as part of hw reconfig, failing +to do so can cause functional issues. + +In the case of ath10k driver, the following errors were observed. + +ath10k_pci : failed to install key for non-existent peer XX:XX:XX:XX:XX:XX +Workqueue: events_freezable ieee80211_restart_work [mac80211] +(unwind_backtrace) from (show_stack+0x10/0x14) +(show_stack) (dump_stack+0x80/0xa0) +(dump_stack) (warn_slowpath_common+0x68/0x8c) +(warn_slowpath_common) (warn_slowpath_null+0x18/0x20) +(warn_slowpath_null) (ieee80211_enable_keys+0x88/0x154 [mac80211]) +(ieee80211_enable_keys) (ieee80211_reconfig+0xc90/0x19c8 [mac80211]) +(ieee80211_reconfig]) (ieee80211_restart_work+0x8c/0xa0 [mac80211]) +(ieee80211_restart_work) (process_one_work+0x284/0x488) +(process_one_work) (worker_thread+0x228/0x360) +(worker_thread) (kthread+0xd8/0xec) +(kthread) (ret_from_fork+0x14/0x24) + +Also while bringing down the AP VAP, WARN_ONs and errors related to peer +removal were observed. + +ath10k_pci : failed to clear all peer wep keys for vdev 0: -2 +ath10k_pci : failed to disassociate station: 8c:fd:f0:0a:8c:f5 vdev 0: -2 +(unwind_backtrace) (show_stack+0x10/0x14) +(show_stack) (dump_stack+0x80/0xa0) +(dump_stack) (warn_slowpath_common+0x68/0x8c) +(warn_slowpath_common) (warn_slowpath_null+0x18/0x20) +(warn_slowpath_null) (sta_set_sinfo+0xb98/0xc9c [mac80211]) +(sta_set_sinfo [mac80211]) (__sta_info_flush+0xf0/0x134 [mac80211]) +(__sta_info_flush [mac80211]) (ieee80211_stop_ap+0xe8/0x390 [mac80211]) +(ieee80211_stop_ap [mac80211]) (__cfg80211_stop_ap+0xe0/0x3dc [cfg80211]) +(__cfg80211_stop_ap [cfg80211]) (cfg80211_stop_ap+0x30/0x44 [cfg80211]) +(cfg80211_stop_ap [cfg80211]) (genl_rcv_msg+0x274/0x30c) +(genl_rcv_msg) (netlink_rcv_skb+0x58/0xac) +(netlink_rcv_skb) (genl_rcv+0x20/0x34) +(genl_rcv) (netlink_unicast+0x11c/0x204) +(netlink_unicast) (netlink_sendmsg+0x30c/0x370) +(netlink_sendmsg) (sock_sendmsg+0x70/0x84) +(sock_sendmsg) (___sys_sendmsg.part.3+0x188/0x228) +(___sys_sendmsg.part.3) (__sys_sendmsg+0x4c/0x70) +(__sys_sendmsg) (ret_fast_syscall+0x0/0x44) + +These issues got fixed by adding the stations which are +tied to AP_VLANs back to the driver. + +Signed-off-by: Manikanta Pubbisetty +Signed-off-by: Johannes Berg +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + net/mac80211/util.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/net/mac80211/util.c ++++ b/net/mac80211/util.c +@@ -2061,7 +2061,8 @@ int ieee80211_reconfig(struct ieee80211_ + if (!sta->uploaded) + continue; + +- if (sta->sdata->vif.type != NL80211_IFTYPE_AP) ++ if (sta->sdata->vif.type != NL80211_IFTYPE_AP && ++ sta->sdata->vif.type != NL80211_IFTYPE_AP_VLAN) + continue; + + for (state = IEEE80211_STA_NOTEXIST; diff --git a/queue-4.9/media-staging-omap4iss-include-asm-cacheflush.h-after-generic-includes.patch b/queue-4.9/media-staging-omap4iss-include-asm-cacheflush.h-after-generic-includes.patch new file mode 100644 index 00000000000..341ac5697a0 --- /dev/null +++ b/queue-4.9/media-staging-omap4iss-include-asm-cacheflush.h-after-generic-includes.patch @@ -0,0 +1,65 @@ +From foo@baz Sun Aug 26 09:16:12 CEST 2018 +From: Guenter Roeck +Date: Mon, 23 Jul 2018 14:39:33 -0700 +Subject: media: staging: omap4iss: Include asm/cacheflush.h after generic includes + +From: Guenter Roeck + +[ Upstream commit 0894da849f145af51bde88a6b84f95b9c9e0bc66 ] + +Including asm/cacheflush.h first results in the following build error +when trying to build sparc32:allmodconfig, because 'struct page' has not +been declared, and the function declaration ends up creating a separate +(private) declaration of struct page (as a result of function arguments +being in the scope of the function declaration and definition, not in +global scope). + +The C scoping rules do not just affect variable visibility, they also +affect type declaration visibility. + +The end result is that when the actual call site is seen in +, the 'struct page' type in the caller is not the same +'struct page' that the function was declared with, resulting in: + + In file included from arch/sparc/include/asm/page.h:10:0, + ... + from drivers/staging/media/omap4iss/iss_video.c:15: + include/linux/highmem.h: In function 'clear_user_highpage': + include/linux/highmem.h:137:31: error: + passing argument 1 of 'sparc_flush_page_to_ram' from incompatible + pointer type + +Include generic includes files first to fix the problem. + +Fixes: fc96d58c10162 ("[media] v4l: omap4iss: Add support for OMAP4 camera interface - Video devices") +Suggested-by: Linus Torvalds +Acked-by: David S. Miller +Cc: Randy Dunlap +Signed-off-by: Guenter Roeck +[ Added explanation of C scope rules - Linus ] +Signed-off-by: Linus Torvalds +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/staging/media/omap4iss/iss_video.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/drivers/staging/media/omap4iss/iss_video.c ++++ b/drivers/staging/media/omap4iss/iss_video.c +@@ -11,7 +11,6 @@ + * (at your option) any later version. + */ + +-#include + #include + #include + #include +@@ -24,6 +23,8 @@ + #include + #include + ++#include ++ + #include "iss_video.h" + #include "iss.h" + diff --git a/queue-4.9/memcg-remove-memcg_cgroup-id-from-idr-on-mem_cgroup_css_alloc-failure.patch b/queue-4.9/memcg-remove-memcg_cgroup-id-from-idr-on-mem_cgroup_css_alloc-failure.patch new file mode 100644 index 00000000000..8b7c3ae47f1 --- /dev/null +++ b/queue-4.9/memcg-remove-memcg_cgroup-id-from-idr-on-mem_cgroup_css_alloc-failure.patch @@ -0,0 +1,76 @@ +From foo@baz Sun Aug 26 09:16:12 CEST 2018 +From: Kirill Tkhai +Date: Thu, 2 Aug 2018 15:36:01 -0700 +Subject: memcg: remove memcg_cgroup::id from IDR on mem_cgroup_css_alloc() failure + +From: Kirill Tkhai + +[ Upstream commit 7e97de0b033bcac4fa9a35cef72e0c06e6a22c67 ] + +In case of memcg_online_kmem() failure, memcg_cgroup::id remains hashed +in mem_cgroup_idr even after memcg memory is freed. This leads to leak +of ID in mem_cgroup_idr. + +This patch adds removal into mem_cgroup_css_alloc(), which fixes the +problem. For better readability, it adds a generic helper which is used +in mem_cgroup_alloc() and mem_cgroup_id_put_many() as well. + +Link: http://lkml.kernel.org/r/152354470916.22460.14397070748001974638.stgit@localhost.localdomain +Fixes 73f576c04b94 ("mm: memcontrol: fix cgroup creation failure after many small jobs") +Signed-off-by: Kirill Tkhai +Acked-by: Johannes Weiner +Acked-by: Vladimir Davydov +Cc: Michal Hocko +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + mm/memcontrol.c | 15 +++++++++++---- + 1 file changed, 11 insertions(+), 4 deletions(-) + +--- a/mm/memcontrol.c ++++ b/mm/memcontrol.c +@@ -4072,6 +4072,14 @@ static struct cftype mem_cgroup_legacy_f + + static DEFINE_IDR(mem_cgroup_idr); + ++static void mem_cgroup_id_remove(struct mem_cgroup *memcg) ++{ ++ if (memcg->id.id > 0) { ++ idr_remove(&mem_cgroup_idr, memcg->id.id); ++ memcg->id.id = 0; ++ } ++} ++ + static void mem_cgroup_id_get_many(struct mem_cgroup *memcg, unsigned int n) + { + VM_BUG_ON(atomic_read(&memcg->id.ref) <= 0); +@@ -4082,8 +4090,7 @@ static void mem_cgroup_id_put_many(struc + { + VM_BUG_ON(atomic_read(&memcg->id.ref) < n); + if (atomic_sub_and_test(n, &memcg->id.ref)) { +- idr_remove(&mem_cgroup_idr, memcg->id.id); +- memcg->id.id = 0; ++ mem_cgroup_id_remove(memcg); + + /* Memcg ID pins CSS */ + css_put(&memcg->css); +@@ -4208,8 +4215,7 @@ static struct mem_cgroup *mem_cgroup_all + idr_replace(&mem_cgroup_idr, memcg, memcg->id.id); + return memcg; + fail: +- if (memcg->id.id > 0) +- idr_remove(&mem_cgroup_idr, memcg->id.id); ++ mem_cgroup_id_remove(memcg); + __mem_cgroup_free(memcg); + return NULL; + } +@@ -4268,6 +4274,7 @@ mem_cgroup_css_alloc(struct cgroup_subsy + + return &memcg->css; + fail: ++ mem_cgroup_id_remove(memcg); + mem_cgroup_free(memcg); + return ERR_PTR(-ENOMEM); + } diff --git a/queue-4.9/mm-memory.c-check-return-value-of-ioremap_prot.patch b/queue-4.9/mm-memory.c-check-return-value-of-ioremap_prot.patch new file mode 100644 index 00000000000..050d96429a5 --- /dev/null +++ b/queue-4.9/mm-memory.c-check-return-value-of-ioremap_prot.patch @@ -0,0 +1,38 @@ +From foo@baz Sun Aug 26 09:16:12 CEST 2018 +From: "jie@chenjie6@huwei.com" +Date: Fri, 10 Aug 2018 17:23:06 -0700 +Subject: mm/memory.c: check return value of ioremap_prot + +From: "jie@chenjie6@huwei.com" + +[ Upstream commit 24eee1e4c47977bdfb71d6f15f6011e7b6188d04 ] + +ioremap_prot() can return NULL which could lead to an oops. + +Link: http://lkml.kernel.org/r/1533195441-58594-1-git-send-email-chenjie6@huawei.com +Signed-off-by: chen jie +Reviewed-by: Andrew Morton +Cc: Li Zefan +Cc: chenjie +Cc: Yang Shi +Cc: Alexey Dobriyan +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + mm/memory.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/mm/memory.c ++++ b/mm/memory.c +@@ -3861,6 +3861,9 @@ int generic_access_phys(struct vm_area_s + return -EINVAL; + + maddr = ioremap_prot(phys_addr, PAGE_ALIGN(len + offset), prot); ++ if (!maddr) ++ return -ENOMEM; ++ + if (write) + memcpy_toio(maddr + offset, buf, len); + else diff --git a/queue-4.9/net-axienet-fix-double-deregister-of-mdio.patch b/queue-4.9/net-axienet-fix-double-deregister-of-mdio.patch new file mode 100644 index 00000000000..d84bf8d0a56 --- /dev/null +++ b/queue-4.9/net-axienet-fix-double-deregister-of-mdio.patch @@ -0,0 +1,61 @@ +From foo@baz Sun Aug 26 09:16:12 CEST 2018 +From: Shubhrajyoti Datta +Date: Tue, 24 Jul 2018 10:09:53 +0530 +Subject: net: axienet: Fix double deregister of mdio + +From: Shubhrajyoti Datta + +[ Upstream commit 03bc7cab7d7218088412a75e141696a89059ab00 ] + +If the registration fails then mdio_unregister is called. +However at unbind the unregister ia attempted again resulting +in the below crash + +[ 73.544038] kernel BUG at drivers/net/phy/mdio_bus.c:415! +[ 73.549362] Internal error: Oops - BUG: 0 [#1] SMP +[ 73.554127] Modules linked in: +[ 73.557168] CPU: 0 PID: 2249 Comm: sh Not tainted 4.14.0 #183 +[ 73.562895] Hardware name: xlnx,zynqmp (DT) +[ 73.567062] task: ffffffc879e41180 task.stack: ffffff800cbe0000 +[ 73.572973] PC is at mdiobus_unregister+0x84/0x88 +[ 73.577656] LR is at axienet_mdio_teardown+0x18/0x30 +[ 73.582601] pc : [] lr : [] +pstate: 20000145 +[ 73.589981] sp : ffffff800cbe3c30 +[ 73.593277] x29: ffffff800cbe3c30 x28: ffffffc879e41180 +[ 73.598573] x27: ffffff8008a21000 x26: 0000000000000040 +[ 73.603868] x25: 0000000000000124 x24: ffffffc879efe920 +[ 73.609164] x23: 0000000000000060 x22: ffffffc879e02000 +[ 73.614459] x21: ffffffc879e02800 x20: ffffffc87b0b8870 +[ 73.619754] x19: ffffffc879e02800 x18: 000000000000025d +[ 73.625050] x17: 0000007f9a719ad0 x16: ffffff8008195bd8 +[ 73.630345] x15: 0000007f9a6b3d00 x14: 0000000000000010 +[ 73.635640] x13: 74656e7265687465 x12: 0000000000000030 +[ 73.640935] x11: 0000000000000030 x10: 0101010101010101 +[ 73.646231] x9 : 241f394f42533300 x8 : ffffffc8799f6e98 +[ 73.651526] x7 : ffffffc8799f6f18 x6 : ffffffc87b0ba318 +[ 73.656822] x5 : ffffffc87b0ba498 x4 : 0000000000000000 +[ 73.662117] x3 : 0000000000000000 x2 : 0000000000000008 +[ 73.667412] x1 : 0000000000000004 x0 : ffffffc8799f4000 +[ 73.672708] Process sh (pid: 2249, stack limit = 0xffffff800cbe0000) + +Fix the same by making the bus NULL on unregister. + +Signed-off-by: Shubhrajyoti Datta +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c ++++ b/drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c +@@ -217,6 +217,7 @@ issue: + ret = of_mdiobus_register(bus, np1); + if (ret) { + mdiobus_free(bus); ++ lp->mii_bus = NULL; + return ret; + } + return 0; diff --git a/queue-4.9/net-caif-add-a-missing-rcu_read_unlock-in-caif_flow_cb.patch b/queue-4.9/net-caif-add-a-missing-rcu_read_unlock-in-caif_flow_cb.patch new file mode 100644 index 00000000000..092903d40eb --- /dev/null +++ b/queue-4.9/net-caif-add-a-missing-rcu_read_unlock-in-caif_flow_cb.patch @@ -0,0 +1,34 @@ +From foo@baz Sun Aug 26 09:16:12 CEST 2018 +From: YueHaibing +Date: Thu, 19 Jul 2018 10:27:13 +0800 +Subject: net: caif: Add a missing rcu_read_unlock() in caif_flow_cb + +From: YueHaibing + +[ Upstream commit 64119e05f7b31e83e2555f6782e6cdc8f81c63f4 ] + +Add a missing rcu_read_unlock in the error path + +Fixes: c95567c80352 ("caif: added check for potential null return") +Signed-off-by: YueHaibing +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + net/caif/caif_dev.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +--- a/net/caif/caif_dev.c ++++ b/net/caif/caif_dev.c +@@ -131,8 +131,10 @@ static void caif_flow_cb(struct sk_buff + caifd = caif_get(skb->dev); + + WARN_ON(caifd == NULL); +- if (caifd == NULL) ++ if (!caifd) { ++ rcu_read_unlock(); + return; ++ } + + caifd_hold(caifd); + rcu_read_unlock(); diff --git a/queue-4.9/net-prevent-isa-drivers-from-building-on-ppc32.patch b/queue-4.9/net-prevent-isa-drivers-from-building-on-ppc32.patch new file mode 100644 index 00000000000..a88669dbb7a --- /dev/null +++ b/queue-4.9/net-prevent-isa-drivers-from-building-on-ppc32.patch @@ -0,0 +1,77 @@ +From foo@baz Sun Aug 26 09:16:12 CEST 2018 +From: Randy Dunlap +Date: Sat, 21 Jul 2018 12:59:25 -0700 +Subject: net: prevent ISA drivers from building on PPC32 + +From: Randy Dunlap + +[ Upstream commit c9ce1fa1c24b08e13c2a3b5b1f94a19c9eaa982c ] + +Prevent drivers from building on PPC32 if they use isa_bus_to_virt(), +isa_virt_to_bus(), or isa_page_to_bus(), which are not available and +thus cause build errors. + +../drivers/net/ethernet/3com/3c515.c: In function 'corkscrew_open': +../drivers/net/ethernet/3com/3c515.c:824:9: error: implicit declaration of function 'isa_virt_to_bus'; did you mean 'virt_to_bus'? [-Werror=implicit-function-declaration] + +../drivers/net/ethernet/amd/lance.c: In function 'lance_rx': +../drivers/net/ethernet/amd/lance.c:1203:23: error: implicit declaration of function 'isa_bus_to_virt'; did you mean 'bus_to_virt'? [-Werror=implicit-function-declaration] + +../drivers/net/ethernet/amd/ni65.c: In function 'ni65_init_lance': +../drivers/net/ethernet/amd/ni65.c:585:20: error: implicit declaration of function 'isa_virt_to_bus'; did you mean 'virt_to_bus'? [-Werror=implicit-function-declaration] + +../drivers/net/ethernet/cirrus/cs89x0.c: In function 'net_open': +../drivers/net/ethernet/cirrus/cs89x0.c:897:20: error: implicit declaration of function 'isa_virt_to_bus'; did you mean 'virt_to_bus'? [-Werror=implicit-function-declaration] + +Signed-off-by: Randy Dunlap +Suggested-by: Michael Ellerman +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/ethernet/3com/Kconfig | 2 +- + drivers/net/ethernet/amd/Kconfig | 4 ++-- + drivers/net/ethernet/cirrus/Kconfig | 1 + + 3 files changed, 4 insertions(+), 3 deletions(-) + +--- a/drivers/net/ethernet/3com/Kconfig ++++ b/drivers/net/ethernet/3com/Kconfig +@@ -32,7 +32,7 @@ config EL3 + + config 3C515 + tristate "3c515 ISA \"Fast EtherLink\"" +- depends on ISA && ISA_DMA_API ++ depends on ISA && ISA_DMA_API && !PPC32 + ---help--- + If you have a 3Com ISA EtherLink XL "Corkscrew" 3c515 Fast Ethernet + network card, say Y here. +--- a/drivers/net/ethernet/amd/Kconfig ++++ b/drivers/net/ethernet/amd/Kconfig +@@ -44,7 +44,7 @@ config AMD8111_ETH + + config LANCE + tristate "AMD LANCE and PCnet (AT1500 and NE2100) support" +- depends on ISA && ISA_DMA_API && !ARM ++ depends on ISA && ISA_DMA_API && !ARM && !PPC32 + ---help--- + If you have a network (Ethernet) card of this type, say Y here. + Some LinkSys cards are of this type. +@@ -138,7 +138,7 @@ config PCMCIA_NMCLAN + + config NI65 + tristate "NI6510 support" +- depends on ISA && ISA_DMA_API && !ARM ++ depends on ISA && ISA_DMA_API && !ARM && !PPC32 + ---help--- + If you have a network (Ethernet) card of this type, say Y here. + +--- a/drivers/net/ethernet/cirrus/Kconfig ++++ b/drivers/net/ethernet/cirrus/Kconfig +@@ -19,6 +19,7 @@ if NET_VENDOR_CIRRUS + config CS89x0 + tristate "CS89x0 support" + depends on ISA || EISA || ARM ++ depends on !PPC32 + ---help--- + Support for CS89x0 chipset based Ethernet cards. If you have a + network (Ethernet) card of this type, say Y and read the file diff --git a/queue-4.9/nl80211-add-a-missing-break-in-parse_station_flags.patch b/queue-4.9/nl80211-add-a-missing-break-in-parse_station_flags.patch new file mode 100644 index 00000000000..1150a2d6241 --- /dev/null +++ b/queue-4.9/nl80211-add-a-missing-break-in-parse_station_flags.patch @@ -0,0 +1,38 @@ +From foo@baz Sun Aug 26 09:16:12 CEST 2018 +From: Bernd Edlinger +Date: Sun, 8 Jul 2018 09:57:22 +0000 +Subject: nl80211: Add a missing break in parse_station_flags + +From: Bernd Edlinger + +[ Upstream commit 5cf3006cc81d9aa09a10aa781fc065546b12919d ] + +I was looking at usually suppressed gcc warnings, +[-Wimplicit-fallthrough=] in this case: + +The code definitely looks like a break is missing here. +However I am not able to test the NL80211_IFTYPE_MESH_POINT, +nor do I actually know what might be :) +So please use this patch with caution and only if you are +able to do some testing. + +Signed-off-by: Bernd Edlinger +[johannes: looks obvious enough to apply as is, interesting + though that it never seems to have been a problem] +Signed-off-by: Johannes Berg +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + net/wireless/nl80211.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/net/wireless/nl80211.c ++++ b/net/wireless/nl80211.c +@@ -4058,6 +4058,7 @@ static int parse_station_flags(struct ge + params->sta_flags_mask = BIT(NL80211_STA_FLAG_AUTHENTICATED) | + BIT(NL80211_STA_FLAG_MFP) | + BIT(NL80211_STA_FLAG_AUTHORIZED); ++ break; + default: + return -EINVAL; + } diff --git a/queue-4.9/perf-x86-amd-ibs-don-t-access-non-started-event.patch b/queue-4.9/perf-x86-amd-ibs-don-t-access-non-started-event.patch new file mode 100644 index 00000000000..a06491cdd5d --- /dev/null +++ b/queue-4.9/perf-x86-amd-ibs-don-t-access-non-started-event.patch @@ -0,0 +1,76 @@ +From foo@baz Sun Aug 26 09:16:12 CEST 2018 +From: Thomas Gleixner +Date: Fri, 20 Jul 2018 10:39:07 +0200 +Subject: perf/x86/amd/ibs: Don't access non-started event + +From: Thomas Gleixner + +[ Upstream commit d2753e6b4882a637a0e8fb3b9c2e15f33265300e ] + +Paul Menzel reported the following bug: + +> Enabling the undefined behavior sanitizer and building GNU/Linux 4.18-rc5+ +> (with some unrelated commits) with GCC 8.1.0 from Debian Sid/unstable, the +> warning below is shown. +> +> > [ 2.111913] +> > ================================================================================ +> > [ 2.111917] UBSAN: Undefined behaviour in arch/x86/events/amd/ibs.c:582:24 +> > [ 2.111919] member access within null pointer of type 'struct perf_event' +> > [ 2.111926] CPU: 0 PID: 144 Comm: udevadm Not tainted 4.18.0-rc5-00316-g4864b68cedf2 #104 +> > [ 2.111928] Hardware name: ASROCK E350M1/E350M1, BIOS TIMELESS 01/01/1970 +> > [ 2.111930] Call Trace: +> > [ 2.111943] dump_stack+0x55/0x89 +> > [ 2.111949] ubsan_epilogue+0xb/0x33 +> > [ 2.111953] handle_null_ptr_deref+0x7f/0x90 +> > [ 2.111958] __ubsan_handle_type_mismatch_v1+0x55/0x60 +> > [ 2.111964] perf_ibs_handle_irq+0x596/0x620 + +The code dereferences event before checking the STARTED bit. Patch +below should cure the issue. + +The warning should not trigger, if I analyzed the thing correctly. +(And Paul's testing confirms this.) + +Reported-by: Paul Menzel +Tested-by: Paul Menzel +Signed-off-by: Thomas Gleixner +Cc: Alexander Shishkin +Cc: Arnaldo Carvalho de Melo +Cc: Borislav Petkov +Cc: Jiri Olsa +Cc: Linus Torvalds +Cc: Paul Menzel +Cc: Peter Zijlstra +Cc: Stephane Eranian +Cc: Vince Weaver +Link: http://lkml.kernel.org/r/alpine.DEB.2.21.1807200958390.1580@nanos.tec.linutronix.de +Signed-off-by: Ingo Molnar +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + arch/x86/events/amd/ibs.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +--- a/arch/x86/events/amd/ibs.c ++++ b/arch/x86/events/amd/ibs.c +@@ -578,7 +578,7 @@ static int perf_ibs_handle_irq(struct pe + { + struct cpu_perf_ibs *pcpu = this_cpu_ptr(perf_ibs->pcpu); + struct perf_event *event = pcpu->event; +- struct hw_perf_event *hwc = &event->hw; ++ struct hw_perf_event *hwc; + struct perf_sample_data data; + struct perf_raw_record raw; + struct pt_regs regs; +@@ -601,6 +601,10 @@ fail: + return 0; + } + ++ if (WARN_ON_ONCE(!event)) ++ goto fail; ++ ++ hwc = &event->hw; + msr = hwc->config_base; + buf = ibs_data.regs; + rdmsrl(msr, *buf); diff --git a/queue-4.9/qed-correct-multicast-api-to-reflect-existence-of-256-approximate-buckets.patch b/queue-4.9/qed-correct-multicast-api-to-reflect-existence-of-256-approximate-buckets.patch new file mode 100644 index 00000000000..17ad6f99e29 --- /dev/null +++ b/queue-4.9/qed-correct-multicast-api-to-reflect-existence-of-256-approximate-buckets.patch @@ -0,0 +1,140 @@ +From foo@baz Sun Aug 26 09:16:12 CEST 2018 +From: Sudarsana Reddy Kalluru +Date: Wed, 18 Jul 2018 22:50:04 -0700 +Subject: qed: Correct Multicast API to reflect existence of 256 approximate buckets. + +From: Sudarsana Reddy Kalluru + +[ Upstream commit 25c020a90919632b3425c19dc09188d56b9ed59a ] + +FW hsi contains 256 approximation buckets which are split in ramrod into +eight u32 values, but driver is using eight 'unsigned long' variables. + +This patch fixes the mcast logic by making the API utilize u32. + +Fixes: 83aeb933 ("qed*: Trivial modifications") +Signed-off-by: Sudarsana Reddy Kalluru +Signed-off-by: Ariel Elior +Signed-off-by: Michal Kalderon +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/ethernet/qlogic/qed/qed_l2.c | 15 +++++++-------- + drivers/net/ethernet/qlogic/qed/qed_l2.h | 2 +- + drivers/net/ethernet/qlogic/qed/qed_sriov.c | 2 +- + drivers/net/ethernet/qlogic/qed/qed_vf.c | 4 ++-- + drivers/net/ethernet/qlogic/qed/qed_vf.h | 7 ++++++- + 5 files changed, 17 insertions(+), 13 deletions(-) + +--- a/drivers/net/ethernet/qlogic/qed/qed_l2.c ++++ b/drivers/net/ethernet/qlogic/qed/qed_l2.c +@@ -313,7 +313,7 @@ qed_sp_update_mcast_bin(struct qed_hwfn + + p_ramrod->common.update_approx_mcast_flg = 1; + for (i = 0; i < ETH_MULTICAST_MAC_BINS_IN_REGS; i++) { +- u32 *p_bins = (u32 *)p_params->bins; ++ u32 *p_bins = p_params->bins; + + p_ramrod->approx_mcast.bins[i] = cpu_to_le32(p_bins[i]); + } +@@ -1182,8 +1182,8 @@ qed_sp_eth_filter_mcast(struct qed_hwfn + enum spq_mode comp_mode, + struct qed_spq_comp_cb *p_comp_data) + { +- unsigned long bins[ETH_MULTICAST_MAC_BINS_IN_REGS]; + struct vport_update_ramrod_data *p_ramrod = NULL; ++ u32 bins[ETH_MULTICAST_MAC_BINS_IN_REGS]; + struct qed_spq_entry *p_ent = NULL; + struct qed_sp_init_data init_data; + u8 abs_vport_id = 0; +@@ -1219,26 +1219,25 @@ qed_sp_eth_filter_mcast(struct qed_hwfn + /* explicitly clear out the entire vector */ + memset(&p_ramrod->approx_mcast.bins, 0, + sizeof(p_ramrod->approx_mcast.bins)); +- memset(bins, 0, sizeof(unsigned long) * +- ETH_MULTICAST_MAC_BINS_IN_REGS); ++ memset(bins, 0, sizeof(bins)); + /* filter ADD op is explicit set op and it removes + * any existing filters for the vport + */ + if (p_filter_cmd->opcode == QED_FILTER_ADD) { + for (i = 0; i < p_filter_cmd->num_mc_addrs; i++) { +- u32 bit; ++ u32 bit, nbits; + + bit = qed_mcast_bin_from_mac(p_filter_cmd->mac[i]); +- __set_bit(bit, bins); ++ nbits = sizeof(u32) * BITS_PER_BYTE; ++ bins[bit / nbits] |= 1 << (bit % nbits); + } + + /* Convert to correct endianity */ + for (i = 0; i < ETH_MULTICAST_MAC_BINS_IN_REGS; i++) { + struct vport_update_ramrod_mcast *p_ramrod_bins; +- u32 *p_bins = (u32 *)bins; + + p_ramrod_bins = &p_ramrod->approx_mcast; +- p_ramrod_bins->bins[i] = cpu_to_le32(p_bins[i]); ++ p_ramrod_bins->bins[i] = cpu_to_le32(bins[i]); + } + } + +--- a/drivers/net/ethernet/qlogic/qed/qed_l2.h ++++ b/drivers/net/ethernet/qlogic/qed/qed_l2.h +@@ -156,7 +156,7 @@ struct qed_sp_vport_update_params { + u8 anti_spoofing_en; + u8 update_accept_any_vlan_flg; + u8 accept_any_vlan; +- unsigned long bins[8]; ++ u32 bins[8]; + struct qed_rss_params *rss_params; + struct qed_filter_accept_flags accept_flags; + struct qed_sge_tpa_params *sge_tpa_params; +--- a/drivers/net/ethernet/qlogic/qed/qed_sriov.c ++++ b/drivers/net/ethernet/qlogic/qed/qed_sriov.c +@@ -2157,7 +2157,7 @@ qed_iov_vp_update_mcast_bin_param(struct + + p_data->update_approx_mcast_flg = 1; + memcpy(p_data->bins, p_mcast_tlv->bins, +- sizeof(unsigned long) * ETH_MULTICAST_MAC_BINS_IN_REGS); ++ sizeof(u32) * ETH_MULTICAST_MAC_BINS_IN_REGS); + *tlvs_mask |= 1 << QED_IOV_VP_UPDATE_MCAST; + } + +--- a/drivers/net/ethernet/qlogic/qed/qed_vf.c ++++ b/drivers/net/ethernet/qlogic/qed/qed_vf.c +@@ -786,7 +786,7 @@ int qed_vf_pf_vport_update(struct qed_hw + resp_size += sizeof(struct pfvf_def_resp_tlv); + + memcpy(p_mcast_tlv->bins, p_params->bins, +- sizeof(unsigned long) * ETH_MULTICAST_MAC_BINS_IN_REGS); ++ sizeof(u32) * ETH_MULTICAST_MAC_BINS_IN_REGS); + } + + update_rx = p_params->accept_flags.update_rx_mode_config; +@@ -972,7 +972,7 @@ void qed_vf_pf_filter_mcast(struct qed_h + u32 bit; + + bit = qed_mcast_bin_from_mac(p_filter_cmd->mac[i]); +- __set_bit(bit, sp_params.bins); ++ sp_params.bins[bit / 32] |= 1 << (bit % 32); + } + } + +--- a/drivers/net/ethernet/qlogic/qed/qed_vf.h ++++ b/drivers/net/ethernet/qlogic/qed/qed_vf.h +@@ -336,7 +336,12 @@ struct vfpf_vport_update_mcast_bin_tlv { + struct channel_tlv tl; + u8 padding[4]; + +- u64 bins[8]; ++ /* There are only 256 approx bins, and in HSI they're divided into ++ * 32-bit values. As old VFs used to set-bit to the values on its side, ++ * the upper half of the array is never expected to contain any data. ++ */ ++ u64 bins[4]; ++ u64 obsolete_bins[4]; + }; + + struct vfpf_vport_update_accept_param_tlv { diff --git a/queue-4.9/qed-fix-possible-race-for-the-link-state-value.patch b/queue-4.9/qed-fix-possible-race-for-the-link-state-value.patch new file mode 100644 index 00000000000..3d224be3eae --- /dev/null +++ b/queue-4.9/qed-fix-possible-race-for-the-link-state-value.patch @@ -0,0 +1,35 @@ +From foo@baz Sun Aug 26 09:16:12 CEST 2018 +From: Sudarsana Reddy Kalluru +Date: Wed, 18 Jul 2018 22:50:03 -0700 +Subject: qed: Fix possible race for the link state value. + +From: Sudarsana Reddy Kalluru + +[ Upstream commit 58874c7b246109d8efb2b0099d1aa296d6bfc3fa ] + +There's a possible race where driver can read link status in mid-transition +and see that virtual-link is up yet speed is 0. Since in this +mid-transition we're guaranteed to see a mailbox from MFW soon, we can +afford to treat this as link down. + +Fixes: cc875c2e ("qed: Add link support") +Signed-off-by: Sudarsana Reddy Kalluru +Signed-off-by: Ariel Elior +Signed-off-by: Michal Kalderon +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/ethernet/qlogic/qed/qed_mcp.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/net/ethernet/qlogic/qed/qed_mcp.c ++++ b/drivers/net/ethernet/qlogic/qed/qed_mcp.c +@@ -613,6 +613,7 @@ static void qed_mcp_handle_link_change(s + break; + default: + p_link->speed = 0; ++ p_link->link_up = 0; + } + + if (p_link->link_up && p_link->speed) diff --git a/queue-4.9/qmi_wwan-fix-interface-number-for-dw5821e-production-firmware.patch b/queue-4.9/qmi_wwan-fix-interface-number-for-dw5821e-production-firmware.patch new file mode 100644 index 00000000000..51f59123169 --- /dev/null +++ b/queue-4.9/qmi_wwan-fix-interface-number-for-dw5821e-production-firmware.patch @@ -0,0 +1,50 @@ +From foo@baz Sun Aug 26 09:16:12 CEST 2018 +From: Aleksander Morgado +Date: Tue, 24 Jul 2018 01:31:07 +0200 +Subject: qmi_wwan: fix interface number for DW5821e production firmware + +From: Aleksander Morgado + +[ Upstream commit f25e1392fdb556290957142ac2da33a02cbff403 ] + +The original mapping for the DW5821e was done using a development +version of the firmware. Confirmed with the vendor that the final +USB layout ends up exposing the QMI control/data ports in USB +config #1, interface #0, not in interface #1 (which is now a HID +interface). + +T: Bus=01 Lev=03 Prnt=04 Port=00 Cnt=01 Dev#= 16 Spd=480 MxCh= 0 +D: Ver= 2.10 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs= 2 +P: Vendor=413c ProdID=81d7 Rev=03.18 +S: Manufacturer=DELL +S: Product=DW5821e Snapdragon X20 LTE +S: SerialNumber=0123456789ABCDEF +C: #Ifs= 6 Cfg#= 1 Atr=a0 MxPwr=500mA +I: If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan +I: If#= 1 Alt= 0 #EPs= 1 Cls=03(HID ) Sub=00 Prot=00 Driver=usbhid +I: If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option +I: If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option +I: If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option +I: If#= 5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option + +Fixes: e7e197edd09c25 ("qmi_wwan: add support for the Dell Wireless 5821e module") +Signed-off-by: Aleksander Morgado +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 | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/usb/qmi_wwan.c ++++ b/drivers/net/usb/qmi_wwan.c +@@ -946,7 +946,7 @@ static const struct usb_device_id produc + {QMI_FIXED_INTF(0x413c, 0x81b3, 8)}, /* Dell Wireless 5809e Gobi(TM) 4G LTE Mobile Broadband Card (rev3) */ + {QMI_FIXED_INTF(0x413c, 0x81b6, 8)}, /* Dell Wireless 5811e */ + {QMI_FIXED_INTF(0x413c, 0x81b6, 10)}, /* Dell Wireless 5811e */ +- {QMI_FIXED_INTF(0x413c, 0x81d7, 1)}, /* Dell Wireless 5821e */ ++ {QMI_FIXED_INTF(0x413c, 0x81d7, 0)}, /* Dell Wireless 5821e */ + {QMI_FIXED_INTF(0x03f0, 0x4e1d, 8)}, /* HP lt4111 LTE/EV-DO/HSPA+ Gobi 4G Module */ + {QMI_FIXED_INTF(0x03f0, 0x9d1d, 1)}, /* HP lt4120 Snapdragon X5 LTE */ + {QMI_FIXED_INTF(0x22de, 0x9061, 3)}, /* WeTelecom WPD-600N */ diff --git a/queue-4.9/revert-mips-bcm47xx-enable-74k-core-externalsync-for-pcie-erratum.patch b/queue-4.9/revert-mips-bcm47xx-enable-74k-core-externalsync-for-pcie-erratum.patch new file mode 100644 index 00000000000..871b0c58771 --- /dev/null +++ b/queue-4.9/revert-mips-bcm47xx-enable-74k-core-externalsync-for-pcie-erratum.patch @@ -0,0 +1,83 @@ +From foo@baz Sun Aug 26 09:16:12 CEST 2018 +From: "Rafał Miłecki" +Date: Fri, 27 Jul 2018 13:13:39 +0200 +Subject: Revert "MIPS: BCM47XX: Enable 74K Core ExternalSync for PCIe erratum" + +From: "Rafał Miłecki" + +[ Upstream commit d5ea019f8a381f88545bb26993b62ec24a2796b7 ] + +This reverts commit 2a027b47dba6 ("MIPS: BCM47XX: Enable 74K Core +ExternalSync for PCIe erratum"). + +Enabling ExternalSync caused a regression for BCM4718A1 (used e.g. in +Netgear E3000 and ASUS RT-N16): it simply hangs during PCIe +initialization. It's likely that BCM4717A1 is also affected. + +I didn't notice that earlier as the only BCM47XX devices with PCIe I +own are: +1) BCM4706 with 2 x 14e4:4331 +2) BCM4706 with 14e4:4360 and 14e4:4331 +it appears that BCM4706 is unaffected. + +While BCM5300X-ES300-RDS.pdf seems to document that erratum and its +workarounds (according to quotes provided by Tokunori) it seems not even +Broadcom follows them. + +According to the provided info Broadcom should define CONF7_ES in their +SDK's mipsinc.h and implement workaround in the si_mips_init(). Checking +both didn't reveal such code. It *could* mean Broadcom also had some +problems with the given workaround. + +Signed-off-by: Rafał Miłecki +Signed-off-by: Paul Burton +Reported-by: Michael Marley +Patchwork: https://patchwork.linux-mips.org/patch/20032/ +URL: https://bugs.openwrt.org/index.php?do=details&task_id=1688 +Cc: Tokunori Ikegami +Cc: Hauke Mehrtens +Cc: Chris Packham +Cc: James Hogan +Cc: Ralf Baechle +Cc: linux-mips@linux-mips.org +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + arch/mips/bcm47xx/setup.c | 6 ------ + arch/mips/include/asm/mipsregs.h | 3 --- + 2 files changed, 9 deletions(-) + +--- a/arch/mips/bcm47xx/setup.c ++++ b/arch/mips/bcm47xx/setup.c +@@ -212,12 +212,6 @@ static int __init bcm47xx_cpu_fixes(void + */ + if (bcm47xx_bus.bcma.bus.chipinfo.id == BCMA_CHIP_ID_BCM4706) + cpu_wait = NULL; +- +- /* +- * BCM47XX Erratum "R10: PCIe Transactions Periodically Fail" +- * Enable ExternalSync for sync instruction to take effect +- */ +- set_c0_config7(MIPS_CONF7_ES); + break; + #endif + } +--- a/arch/mips/include/asm/mipsregs.h ++++ b/arch/mips/include/asm/mipsregs.h +@@ -663,8 +663,6 @@ + #define MIPS_CONF7_WII (_ULCAST_(1) << 31) + + #define MIPS_CONF7_RPS (_ULCAST_(1) << 2) +-/* ExternalSync */ +-#define MIPS_CONF7_ES (_ULCAST_(1) << 8) + + #define MIPS_CONF7_IAR (_ULCAST_(1) << 10) + #define MIPS_CONF7_AR (_ULCAST_(1) << 16) +@@ -2643,7 +2641,6 @@ __BUILD_SET_C0(status) + __BUILD_SET_C0(cause) + __BUILD_SET_C0(config) + __BUILD_SET_C0(config5) +-__BUILD_SET_C0(config7) + __BUILD_SET_C0(intcontrol) + __BUILD_SET_C0(intctl) + __BUILD_SET_C0(srsmap) diff --git a/queue-4.9/scsi-fcoe-clear-fc_rp_started-flags-when-receiving-a-logo.patch b/queue-4.9/scsi-fcoe-clear-fc_rp_started-flags-when-receiving-a-logo.patch new file mode 100644 index 00000000000..1caa60ec343 --- /dev/null +++ b/queue-4.9/scsi-fcoe-clear-fc_rp_started-flags-when-receiving-a-logo.patch @@ -0,0 +1,52 @@ +From foo@baz Sun Aug 26 09:16:12 CEST 2018 +From: Johannes Thumshirn +Date: Tue, 31 Jul 2018 15:46:03 +0200 +Subject: scsi: fcoe: clear FC_RP_STARTED flags when receiving a LOGO + +From: Johannes Thumshirn + +[ Upstream commit 1550ec458e0cf1a40a170ab1f4c46e3f52860f65 ] + +When receiving a LOGO request we forget to clear the FC_RP_STARTED flag +before starting the rport delete routine. + +As the started flag was not cleared, we're not deleting the rport but +waiting for a restart and thus are keeping the reference count of the rdata +object at 1. + +This leads to the following kmemleak report: +unreferenced object 0xffff88006542aa00 (size 512): + comm "kworker/0:2", pid 24, jiffies 4294899222 (age 226.880s) + hex dump (first 32 bytes): + 68 96 fe 65 00 88 ff ff 00 00 00 00 00 00 00 00 h..e............ + 01 00 00 00 08 00 00 00 02 c5 45 24 ac b8 00 10 ..........E$.... + backtrace: + [<(____ptrval____)>] fcoe_ctlr_vn_add.isra.5+0x7f/0x770 [libfcoe] + [<(____ptrval____)>] fcoe_ctlr_vn_recv+0x12af/0x27f0 [libfcoe] + [<(____ptrval____)>] fcoe_ctlr_recv_work+0xd01/0x32f0 [libfcoe] + [<(____ptrval____)>] process_one_work+0x7ff/0x1420 + [<(____ptrval____)>] worker_thread+0x87/0xef0 + [<(____ptrval____)>] kthread+0x2db/0x390 + [<(____ptrval____)>] ret_from_fork+0x35/0x40 + [<(____ptrval____)>] 0xffffffffffffffff + +Signed-off-by: Johannes Thumshirn +Reported-by: ard +Reviewed-by: Hannes Reinecke +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/scsi/libfc/fc_rport.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/scsi/libfc/fc_rport.c ++++ b/drivers/scsi/libfc/fc_rport.c +@@ -1935,6 +1935,7 @@ static void fc_rport_recv_logo_req(struc + FC_RPORT_DBG(rdata, "Received LOGO request while in state %s\n", + fc_rport_state(rdata)); + ++ rdata->flags &= ~FC_RP_STARTED; + fc_rport_enter_delete(rdata, RPORT_EV_STOP); + mutex_unlock(&rdata->rp_mutex); + kref_put(&rdata->kref, rdata->local_port->tt.rport_destroy); diff --git a/queue-4.9/scsi-fcoe-drop-frames-in-els-logo-error-path.patch b/queue-4.9/scsi-fcoe-drop-frames-in-els-logo-error-path.patch new file mode 100644 index 00000000000..42e44c16402 --- /dev/null +++ b/queue-4.9/scsi-fcoe-drop-frames-in-els-logo-error-path.patch @@ -0,0 +1,56 @@ +From foo@baz Sun Aug 26 09:16:12 CEST 2018 +From: Johannes Thumshirn +Date: Tue, 31 Jul 2018 15:46:02 +0200 +Subject: scsi: fcoe: drop frames in ELS LOGO error path + +From: Johannes Thumshirn + +[ Upstream commit 63d0e3dffda311e77b9a8c500d59084e960a824a ] + +Drop the frames in the ELS LOGO error path instead of just returning an +error. + +This fixes the following kmemleak report: +unreferenced object 0xffff880064cb1000 (size 424): + comm "kworker/0:2", pid 24, jiffies 4294904293 (age 68.504s) + hex dump (first 32 bytes): + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ + backtrace: + [<(____ptrval____)>] _fc_frame_alloc+0x2c/0x180 [libfc] + [<(____ptrval____)>] fc_lport_enter_logo+0x106/0x360 [libfc] + [<(____ptrval____)>] fc_fabric_logoff+0x8c/0xc0 [libfc] + [<(____ptrval____)>] fcoe_if_destroy+0x79/0x3b0 [fcoe] + [<(____ptrval____)>] fcoe_destroy_work+0xd2/0x170 [fcoe] + [<(____ptrval____)>] process_one_work+0x7ff/0x1420 + [<(____ptrval____)>] worker_thread+0x87/0xef0 + [<(____ptrval____)>] kthread+0x2db/0x390 + [<(____ptrval____)>] ret_from_fork+0x35/0x40 + [<(____ptrval____)>] 0xffffffffffffffff + +which can be triggered by issuing +echo eth0 > /sys/bus/fcoe/ctlr_destroy + +Signed-off-by: Johannes Thumshirn +Reviewed-by: Hannes Reinecke +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/scsi/fcoe/fcoe_ctlr.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/scsi/fcoe/fcoe_ctlr.c ++++ b/drivers/scsi/fcoe/fcoe_ctlr.c +@@ -755,9 +755,9 @@ int fcoe_ctlr_els_send(struct fcoe_ctlr + case ELS_LOGO: + if (fip->mode == FIP_MODE_VN2VN) { + if (fip->state != FIP_ST_VNMP_UP) +- return -EINVAL; ++ goto drop; + if (ntoh24(fh->fh_d_id) == FC_FID_FLOGI) +- return -EINVAL; ++ goto drop; + } else { + if (fip->state != FIP_ST_ENABLED) + return 0; diff --git a/queue-4.9/scsi-libiscsi-fix-possible-null-pointer-dereference-in-case-of-tmf.patch b/queue-4.9/scsi-libiscsi-fix-possible-null-pointer-dereference-in-case-of-tmf.patch new file mode 100644 index 00000000000..ead18b9bf15 --- /dev/null +++ b/queue-4.9/scsi-libiscsi-fix-possible-null-pointer-dereference-in-case-of-tmf.patch @@ -0,0 +1,69 @@ +From foo@baz Sun Aug 26 09:16:12 CEST 2018 +From: Varun Prakash +Date: Wed, 11 Jul 2018 22:09:52 +0530 +Subject: scsi: libiscsi: fix possible NULL pointer dereference in case of TMF + +From: Varun Prakash + +[ Upstream commit a17037e7d59075053b522048742a08ac9500bde8 ] + +In iscsi_check_tmf_restrictions() task->hdr is dereferenced to print the +opcode, it is possible that task->hdr is NULL. + +There are two cases based on opcode argument: + +1. ISCSI_OP_SCSI_CMD - In this case alloc_pdu() is called +after iscsi_check_tmf_restrictions() + +iscsi_prep_scsi_cmd_pdu() -> iscsi_check_tmf_restrictions() -> alloc_pdu(). + +Transport drivers allocate memory for iSCSI hdr in alloc_pdu() and assign +it to task->hdr. In case of TMF task->hdr will be NULL resulting in NULL +pointer dereference. + +2. ISCSI_OP_SCSI_DATA_OUT - In this case transport driver can free the +memory for iSCSI hdr after transmitting the pdu so task->hdr can be NULL or +invalid. + +This patch fixes this issue by removing task->hdr->opcode from the printk +statement. + +Signed-off-by: Varun Prakash +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/scsi/libiscsi.c | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +--- a/drivers/scsi/libiscsi.c ++++ b/drivers/scsi/libiscsi.c +@@ -283,11 +283,11 @@ static int iscsi_check_tmf_restrictions( + */ + if (opcode != ISCSI_OP_SCSI_DATA_OUT) { + iscsi_conn_printk(KERN_INFO, conn, +- "task [op %x/%x itt " ++ "task [op %x itt " + "0x%x/0x%x] " + "rejected.\n", +- task->hdr->opcode, opcode, +- task->itt, task->hdr_itt); ++ opcode, task->itt, ++ task->hdr_itt); + return -EACCES; + } + /* +@@ -296,10 +296,10 @@ static int iscsi_check_tmf_restrictions( + */ + if (conn->session->fast_abort) { + iscsi_conn_printk(KERN_INFO, conn, +- "task [op %x/%x itt " ++ "task [op %x itt " + "0x%x/0x%x] fast abort.\n", +- task->hdr->opcode, opcode, +- task->itt, task->hdr_itt); ++ opcode, task->itt, ++ task->hdr_itt); + return -EACCES; + } + break; diff --git a/queue-4.9/scsi-vmw_pvscsi-return-did_reset-for-status-sam_stat_command_terminated.patch b/queue-4.9/scsi-vmw_pvscsi-return-did_reset-for-status-sam_stat_command_terminated.patch new file mode 100644 index 00000000000..adf353bf6d9 --- /dev/null +++ b/queue-4.9/scsi-vmw_pvscsi-return-did_reset-for-status-sam_stat_command_terminated.patch @@ -0,0 +1,47 @@ +From foo@baz Sun Aug 26 09:16:12 CEST 2018 +From: Jim Gill +Date: Thu, 2 Aug 2018 14:13:30 -0700 +Subject: scsi: vmw_pvscsi: Return DID_RESET for status SAM_STAT_COMMAND_TERMINATED + +From: Jim Gill + +[ Upstream commit e95153b64d03c2b6e8d62e51bdcc33fcad6e0856 ] + +Commands that are reset are returned with status +SAM_STAT_COMMAND_TERMINATED. PVSCSI currently returns DID_OK | +SAM_STAT_COMMAND_TERMINATED which fails the command. Instead, set hostbyte +to DID_RESET to allow upper layers to retry. + +Tested by copying a large file between two pvscsi disks on same adapter +while performing a bus reset at 1-second intervals. Before fix, commands +sometimes fail with DID_OK. After fix, commands observed to fail with +DID_RESET. + +Signed-off-by: Jim Gill +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/scsi/vmw_pvscsi.c | 11 ++++++++--- + 1 file changed, 8 insertions(+), 3 deletions(-) + +--- a/drivers/scsi/vmw_pvscsi.c ++++ b/drivers/scsi/vmw_pvscsi.c +@@ -564,9 +564,14 @@ static void pvscsi_complete_request(stru + (btstat == BTSTAT_SUCCESS || + btstat == BTSTAT_LINKED_COMMAND_COMPLETED || + btstat == BTSTAT_LINKED_COMMAND_COMPLETED_WITH_FLAG)) { +- cmd->result = (DID_OK << 16) | sdstat; +- if (sdstat == SAM_STAT_CHECK_CONDITION && cmd->sense_buffer) +- cmd->result |= (DRIVER_SENSE << 24); ++ if (sdstat == SAM_STAT_COMMAND_TERMINATED) { ++ cmd->result = (DID_RESET << 16); ++ } else { ++ cmd->result = (DID_OK << 16) | sdstat; ++ if (sdstat == SAM_STAT_CHECK_CONDITION && ++ cmd->sense_buffer) ++ cmd->result |= (DRIVER_SENSE << 24); ++ } + } else + switch (btstat) { + case BTSTAT_SUCCESS: diff --git a/queue-4.9/selftests-ftrace-add-snapshot-and-tracing_on-test-case.patch b/queue-4.9/selftests-ftrace-add-snapshot-and-tracing_on-test-case.patch new file mode 100644 index 00000000000..905af8574e9 --- /dev/null +++ b/queue-4.9/selftests-ftrace-add-snapshot-and-tracing_on-test-case.patch @@ -0,0 +1,60 @@ +From foo@baz Sun Aug 26 09:16:12 CEST 2018 +From: Masami Hiramatsu +Date: Sat, 14 Jul 2018 01:28:44 +0900 +Subject: selftests/ftrace: Add snapshot and tracing_on test case + +From: Masami Hiramatsu + +[ Upstream commit 82f4f3e69c5c29bce940dd87a2c0f16c51d48d17 ] + +Add a testcase for checking snapshot and tracing_on +relationship. This ensures that the snapshotting doesn't +affect current tracing on/off settings. + +Link: http://lkml.kernel.org/r/153149932412.11274.15289227592627901488.stgit@devbox + +Cc: Tom Zanussi +Cc: Hiraku Toyooka +Signed-off-by: Masami Hiramatsu +Cc: Ingo Molnar +Cc: Shuah Khan +Cc: linux-kselftest@vger.kernel.org +Signed-off-by: Steven Rostedt (VMware) +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + tools/testing/selftests/ftrace/test.d/00basic/snapshot.tc | 28 ++++++++++++++ + 1 file changed, 28 insertions(+) + create mode 100644 tools/testing/selftests/ftrace/test.d/00basic/snapshot.tc + +--- /dev/null ++++ b/tools/testing/selftests/ftrace/test.d/00basic/snapshot.tc +@@ -0,0 +1,28 @@ ++#!/bin/sh ++# description: Snapshot and tracing setting ++# flags: instance ++ ++[ ! -f snapshot ] && exit_unsupported ++ ++echo "Set tracing off" ++echo 0 > tracing_on ++ ++echo "Allocate and take a snapshot" ++echo 1 > snapshot ++ ++# Since trace buffer is empty, snapshot is also empty, but allocated ++grep -q "Snapshot is allocated" snapshot ++ ++echo "Ensure keep tracing off" ++test `cat tracing_on` -eq 0 ++ ++echo "Set tracing on" ++echo 1 > tracing_on ++ ++echo "Take a snapshot again" ++echo 1 > snapshot ++ ++echo "Ensure keep tracing on" ++test `cat tracing_on` -eq 1 ++ ++exit 0 diff --git a/queue-4.9/series b/queue-4.9/series index e69de29bb2d..a554e4ea50f 100644 --- a/queue-4.9/series +++ b/queue-4.9/series @@ -0,0 +1,49 @@ +vti6-fix-pmtu-caching-and-reporting-on-xmit.patch +xfrm-fix-missing-dst_release-after-policy-blocking-lbcast-and-multicast.patch +xfrm-free-skb-if-nlsk-pointer-is-null.patch +mac80211-add-stations-tied-to-ap_vlans-during-hw-reconfig.patch +nl80211-add-a-missing-break-in-parse_station_flags.patch +drm-bridge-adv7511-reset-registers-on-hotplug.patch +scsi-libiscsi-fix-possible-null-pointer-dereference-in-case-of-tmf.patch +drm-re-enable-error-handling.patch +drm-imx-imx-ldb-disable-ldb-on-driver-bind.patch +drm-imx-imx-ldb-check-if-channel-is-enabled-before-printing-warning.patch +usb-gadget-r8a66597-fix-two-possible-sleep-in-atomic-context-bugs-in-init_controller.patch +usb-gadget-r8a66597-fix-a-possible-sleep-in-atomic-context-bugs-in-r8a66597_queue.patch +usb-phy-fix-ppc64-build-errors-in-phy-fsl-usb.c.patch +tools-usb-ffs-test-fix-build-on-big-endian-systems.patch +usb-gadget-f_uac2-fix-endianness-of-struct-cntrl_-_lay3.patch +bpf-ppc64-fix-unexpected-r0-0-exit-path-inside-bpf_xadd.patch +tools-power-turbostat-fix-s-on-up-systems.patch +net-caif-add-a-missing-rcu_read_unlock-in-caif_flow_cb.patch +qed-fix-possible-race-for-the-link-state-value.patch +qed-correct-multicast-api-to-reflect-existence-of-256-approximate-buckets.patch +atl1c-reserve-min-skb-headroom.patch +net-prevent-isa-drivers-from-building-on-ppc32.patch +can-mpc5xxx_can-check-of_iomap-return-before-use.patch +i2c-davinci-avoid-zero-value-of-clkh.patch +perf-x86-amd-ibs-don-t-access-non-started-event.patch +media-staging-omap4iss-include-asm-cacheflush.h-after-generic-includes.patch +bnx2x-fix-invalid-memory-access-in-rss-hash-config-path.patch +qmi_wwan-fix-interface-number-for-dw5821e-production-firmware.patch +net-axienet-fix-double-deregister-of-mdio.patch +x86-boot-fix-if_changed-build-flip-flop-bug.patch +fscache-allow-cancelled-operations-to-be-enqueued.patch +cachefiles-fix-refcounting-bug-in-backing-file-read-monitoring.patch +cachefiles-wait-rather-than-bug-ing-on-unexpected-object-collision.patch +selftests-ftrace-add-snapshot-and-tracing_on-test-case.patch +zswap-re-check-zswap_is_full-after-do-zswap_shrink.patch +tools-power-turbostat-read-extended-processor-family-from-cpuid.patch +revert-mips-bcm47xx-enable-74k-core-externalsync-for-pcie-erratum.patch +enic-handle-mtu-change-for-vf-properly.patch +arc-fix-data-type-errors-in-platform-headers.patch +arc-fix-build-errors-in-arc-include-asm-delay.h.patch +arc-fix-type-warnings-in-arc-mm-cache.c.patch +squashfs-metadata-2-electric-boogaloo.patch +squashfs-compute-expected-length-from-inode-size-rather-than-block-length.patch +drivers-net-lmc-fix-case-value-for-target-abort-error.patch +memcg-remove-memcg_cgroup-id-from-idr-on-mem_cgroup_css_alloc-failure.patch +scsi-fcoe-drop-frames-in-els-logo-error-path.patch +scsi-fcoe-clear-fc_rp_started-flags-when-receiving-a-logo.patch +scsi-vmw_pvscsi-return-did_reset-for-status-sam_stat_command_terminated.patch +mm-memory.c-check-return-value-of-ioremap_prot.patch diff --git a/queue-4.9/squashfs-compute-expected-length-from-inode-size-rather-than-block-length.patch b/queue-4.9/squashfs-compute-expected-length-from-inode-size-rather-than-block-length.patch new file mode 100644 index 00000000000..87a8c86b75e --- /dev/null +++ b/queue-4.9/squashfs-compute-expected-length-from-inode-size-rather-than-block-length.patch @@ -0,0 +1,179 @@ +From foo@baz Sun Aug 26 09:16:12 CEST 2018 +From: Phillip Lougher +Date: Thu, 2 Aug 2018 16:45:15 +0100 +Subject: Squashfs: Compute expected length from inode size rather than block length + +From: Phillip Lougher + +[ Upstream commit a3f94cb99a854fa381fe7fadd97c4f61633717a5 ] + +Previously in squashfs_readpage() when copying data into the page +cache, it used the length of the datablock read from the filesystem +(after decompression). However, if the filesystem has been corrupted +this data block may be short, which will leave pages unfilled. + +The fix for this is to compute the expected number of bytes to copy +from the inode size, and use this to detect if the block is short. + +Signed-off-by: Phillip Lougher +Tested-by: Willy Tarreau +Cc: Анатолий Тросиненко +Signed-off-by: Linus Torvalds +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + fs/squashfs/file.c | 25 ++++++++++--------------- + fs/squashfs/file_cache.c | 4 ++-- + fs/squashfs/file_direct.c | 16 +++++++++++----- + fs/squashfs/squashfs.h | 2 +- + 4 files changed, 24 insertions(+), 23 deletions(-) + +--- a/fs/squashfs/file.c ++++ b/fs/squashfs/file.c +@@ -431,10 +431,9 @@ skip_page: + } + + /* Read datablock stored packed inside a fragment (tail-end packed block) */ +-static int squashfs_readpage_fragment(struct page *page) ++static int squashfs_readpage_fragment(struct page *page, int expected) + { + struct inode *inode = page->mapping->host; +- struct squashfs_sb_info *msblk = inode->i_sb->s_fs_info; + struct squashfs_cache_entry *buffer = squashfs_get_fragment(inode->i_sb, + squashfs_i(inode)->fragment_block, + squashfs_i(inode)->fragment_size); +@@ -445,23 +444,16 @@ static int squashfs_readpage_fragment(st + squashfs_i(inode)->fragment_block, + squashfs_i(inode)->fragment_size); + else +- squashfs_copy_cache(page, buffer, i_size_read(inode) & +- (msblk->block_size - 1), ++ squashfs_copy_cache(page, buffer, expected, + squashfs_i(inode)->fragment_offset); + + squashfs_cache_put(buffer); + return res; + } + +-static int squashfs_readpage_sparse(struct page *page, int index, int file_end) ++static int squashfs_readpage_sparse(struct page *page, int expected) + { +- struct inode *inode = page->mapping->host; +- struct squashfs_sb_info *msblk = inode->i_sb->s_fs_info; +- int bytes = index == file_end ? +- (i_size_read(inode) & (msblk->block_size - 1)) : +- msblk->block_size; +- +- squashfs_copy_cache(page, NULL, bytes, 0); ++ squashfs_copy_cache(page, NULL, expected, 0); + return 0; + } + +@@ -471,6 +463,9 @@ static int squashfs_readpage(struct file + struct squashfs_sb_info *msblk = inode->i_sb->s_fs_info; + int index = page->index >> (msblk->block_log - PAGE_SHIFT); + int file_end = i_size_read(inode) >> msblk->block_log; ++ int expected = index == file_end ? ++ (i_size_read(inode) & (msblk->block_size - 1)) : ++ msblk->block_size; + int res; + void *pageaddr; + +@@ -489,11 +484,11 @@ static int squashfs_readpage(struct file + goto error_out; + + if (bsize == 0) +- res = squashfs_readpage_sparse(page, index, file_end); ++ res = squashfs_readpage_sparse(page, expected); + else +- res = squashfs_readpage_block(page, block, bsize); ++ res = squashfs_readpage_block(page, block, bsize, expected); + } else +- res = squashfs_readpage_fragment(page); ++ res = squashfs_readpage_fragment(page, expected); + + if (!res) + return 0; +--- a/fs/squashfs/file_cache.c ++++ b/fs/squashfs/file_cache.c +@@ -20,7 +20,7 @@ + #include "squashfs.h" + + /* Read separately compressed datablock and memcopy into page cache */ +-int squashfs_readpage_block(struct page *page, u64 block, int bsize) ++int squashfs_readpage_block(struct page *page, u64 block, int bsize, int expected) + { + struct inode *i = page->mapping->host; + struct squashfs_cache_entry *buffer = squashfs_get_datablock(i->i_sb, +@@ -31,7 +31,7 @@ int squashfs_readpage_block(struct page + ERROR("Unable to read page, block %llx, size %x\n", block, + bsize); + else +- squashfs_copy_cache(page, buffer, buffer->length, 0); ++ squashfs_copy_cache(page, buffer, expected, 0); + + squashfs_cache_put(buffer); + return res; +--- a/fs/squashfs/file_direct.c ++++ b/fs/squashfs/file_direct.c +@@ -21,10 +21,11 @@ + #include "page_actor.h" + + static int squashfs_read_cache(struct page *target_page, u64 block, int bsize, +- int pages, struct page **page); ++ int pages, struct page **page, int bytes); + + /* Read separately compressed datablock directly into page cache */ +-int squashfs_readpage_block(struct page *target_page, u64 block, int bsize) ++int squashfs_readpage_block(struct page *target_page, u64 block, int bsize, ++ int expected) + + { + struct inode *inode = target_page->mapping->host; +@@ -83,7 +84,7 @@ int squashfs_readpage_block(struct page + * using an intermediate buffer. + */ + res = squashfs_read_cache(target_page, block, bsize, pages, +- page); ++ page, expected); + if (res < 0) + goto mark_errored; + +@@ -95,6 +96,11 @@ int squashfs_readpage_block(struct page + if (res < 0) + goto mark_errored; + ++ if (res != expected) { ++ res = -EIO; ++ goto mark_errored; ++ } ++ + /* Last page may have trailing bytes not filled */ + bytes = res % PAGE_SIZE; + if (bytes) { +@@ -138,12 +144,12 @@ out: + + + static int squashfs_read_cache(struct page *target_page, u64 block, int bsize, +- int pages, struct page **page) ++ int pages, struct page **page, int bytes) + { + struct inode *i = target_page->mapping->host; + struct squashfs_cache_entry *buffer = squashfs_get_datablock(i->i_sb, + block, bsize); +- int bytes = buffer->length, res = buffer->error, n, offset = 0; ++ int res = buffer->error, n, offset = 0; + + if (res) { + ERROR("Unable to read page, block %llx, size %x\n", block, +--- a/fs/squashfs/squashfs.h ++++ b/fs/squashfs/squashfs.h +@@ -72,7 +72,7 @@ void squashfs_copy_cache(struct page *, + int); + + /* file_xxx.c */ +-extern int squashfs_readpage_block(struct page *, u64, int); ++extern int squashfs_readpage_block(struct page *, u64, int, int); + + /* id.c */ + extern int squashfs_get_id(struct super_block *, unsigned int, unsigned int *); diff --git a/queue-4.9/squashfs-metadata-2-electric-boogaloo.patch b/queue-4.9/squashfs-metadata-2-electric-boogaloo.patch new file mode 100644 index 00000000000..d4e1a38d8a6 --- /dev/null +++ b/queue-4.9/squashfs-metadata-2-electric-boogaloo.patch @@ -0,0 +1,125 @@ +From foo@baz Sun Aug 26 09:16:12 CEST 2018 +From: Linus Torvalds +Date: Wed, 1 Aug 2018 10:38:43 -0700 +Subject: squashfs metadata 2: electric boogaloo + +From: Linus Torvalds + +[ Upstream commit cdbb65c4c7ead680ebe54f4f0d486e2847a500ea ] + +Anatoly continues to find issues with fuzzed squashfs images. + +This time, corrupt, missing, or undersized data for the page filling +wasn't checked for, because the squashfs_{copy,read}_cache() functions +did the squashfs_copy_data() call without checking the resulting data +size. + +Which could result in the page cache pages being incompletely filled in, +and no error indication to the user space reading garbage data. + +So make a helper function for the "fill in pages" case, because the +exact same incomplete sequence existed in two places. + +[ I should have made a squashfs branch for these things, but I didn't + intend to start doing them in the first place. + + My historical connection through cramfs is why I got into looking at + these issues at all, and every time I (continue to) think it's a + one-off. + + Because _this_ time is always the last time. Right? - Linus ] + +Reported-by: Anatoly Trosinenko +Tested-by: Willy Tarreau +Cc: Al Viro +Cc: Phillip Lougher +Signed-off-by: Linus Torvalds +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + fs/squashfs/file.c | 25 ++++++++++++++++++------- + fs/squashfs/file_direct.c | 8 +------- + fs/squashfs/squashfs.h | 1 + + 3 files changed, 20 insertions(+), 14 deletions(-) + +--- a/fs/squashfs/file.c ++++ b/fs/squashfs/file.c +@@ -374,13 +374,29 @@ static int read_blocklist(struct inode * + return squashfs_block_size(size); + } + ++void squashfs_fill_page(struct page *page, struct squashfs_cache_entry *buffer, int offset, int avail) ++{ ++ int copied; ++ void *pageaddr; ++ ++ pageaddr = kmap_atomic(page); ++ copied = squashfs_copy_data(pageaddr, buffer, offset, avail); ++ memset(pageaddr + copied, 0, PAGE_SIZE - copied); ++ kunmap_atomic(pageaddr); ++ ++ flush_dcache_page(page); ++ if (copied == avail) ++ SetPageUptodate(page); ++ else ++ SetPageError(page); ++} ++ + /* Copy data into page cache */ + void squashfs_copy_cache(struct page *page, struct squashfs_cache_entry *buffer, + int bytes, int offset) + { + struct inode *inode = page->mapping->host; + struct squashfs_sb_info *msblk = inode->i_sb->s_fs_info; +- void *pageaddr; + int i, mask = (1 << (msblk->block_log - PAGE_SHIFT)) - 1; + int start_index = page->index & ~mask, end_index = start_index | mask; + +@@ -406,12 +422,7 @@ void squashfs_copy_cache(struct page *pa + if (PageUptodate(push_page)) + goto skip_page; + +- pageaddr = kmap_atomic(push_page); +- squashfs_copy_data(pageaddr, buffer, offset, avail); +- memset(pageaddr + avail, 0, PAGE_SIZE - avail); +- kunmap_atomic(pageaddr); +- flush_dcache_page(push_page); +- SetPageUptodate(push_page); ++ squashfs_fill_page(push_page, buffer, offset, avail); + skip_page: + unlock_page(push_page); + if (i != page->index) +--- a/fs/squashfs/file_direct.c ++++ b/fs/squashfs/file_direct.c +@@ -144,7 +144,6 @@ static int squashfs_read_cache(struct pa + struct squashfs_cache_entry *buffer = squashfs_get_datablock(i->i_sb, + block, bsize); + int bytes = buffer->length, res = buffer->error, n, offset = 0; +- void *pageaddr; + + if (res) { + ERROR("Unable to read page, block %llx, size %x\n", block, +@@ -159,12 +158,7 @@ static int squashfs_read_cache(struct pa + if (page[n] == NULL) + continue; + +- pageaddr = kmap_atomic(page[n]); +- squashfs_copy_data(pageaddr, buffer, offset, avail); +- memset(pageaddr + avail, 0, PAGE_SIZE - avail); +- kunmap_atomic(pageaddr); +- flush_dcache_page(page[n]); +- SetPageUptodate(page[n]); ++ squashfs_fill_page(page[n], buffer, offset, avail); + unlock_page(page[n]); + if (page[n] != target_page) + put_page(page[n]); +--- a/fs/squashfs/squashfs.h ++++ b/fs/squashfs/squashfs.h +@@ -67,6 +67,7 @@ extern __le64 *squashfs_read_fragment_in + u64, u64, unsigned int); + + /* file.c */ ++void squashfs_fill_page(struct page *, struct squashfs_cache_entry *, int, int); + void squashfs_copy_cache(struct page *, struct squashfs_cache_entry *, int, + int); + diff --git a/queue-4.9/tools-power-turbostat-fix-s-on-up-systems.patch b/queue-4.9/tools-power-turbostat-fix-s-on-up-systems.patch new file mode 100644 index 00000000000..41e430eca3d --- /dev/null +++ b/queue-4.9/tools-power-turbostat-fix-s-on-up-systems.patch @@ -0,0 +1,32 @@ +From foo@baz Sun Aug 26 09:16:12 CEST 2018 +From: Len Brown +Date: Fri, 20 Jul 2018 14:47:03 -0400 +Subject: tools/power turbostat: fix -S on UP systems + +From: Len Brown + +[ Upstream commit 9d83601a9cc1884d1b5706ee2acc661d558c6838 ] + +The -S (system summary) option failed to print any data on a 1-processor system. + +Reported-by: Artem Bityutskiy +Signed-off-by: Len Brown +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + tools/power/x86/turbostat/turbostat.c | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +--- a/tools/power/x86/turbostat/turbostat.c ++++ b/tools/power/x86/turbostat/turbostat.c +@@ -733,9 +733,7 @@ void format_all_counters(struct thread_d + if (!printed || !summary_only) + print_header(); + +- if (topo.num_cpus > 1) +- format_counters(&average.threads, &average.cores, +- &average.packages); ++ format_counters(&average.threads, &average.cores, &average.packages); + + printed = 1; + diff --git a/queue-4.9/tools-power-turbostat-read-extended-processor-family-from-cpuid.patch b/queue-4.9/tools-power-turbostat-read-extended-processor-family-from-cpuid.patch new file mode 100644 index 00000000000..a077c19350d --- /dev/null +++ b/queue-4.9/tools-power-turbostat-read-extended-processor-family-from-cpuid.patch @@ -0,0 +1,41 @@ +From foo@baz Sun Aug 26 09:16:12 CEST 2018 +From: Calvin Walton +Date: Fri, 27 Jul 2018 07:50:53 -0400 +Subject: tools/power turbostat: Read extended processor family from CPUID + +From: Calvin Walton + +[ Upstream commit 5aa3d1a20a233d4a5f1ec3d62da3f19d9afea682 ] + +This fixes the reported family on modern AMD processors (e.g. Ryzen, +which is family 0x17). Previously these processors all showed up as +family 0xf. + +See the document +https://support.amd.com/TechDocs/56255_OSRR.pdf +section CPUID_Fn00000001_EAX for how to calculate the family +from the BaseFamily and ExtFamily values. + +This matches the code in arch/x86/lib/cpu.c + +Signed-off-by: Calvin Walton +Signed-off-by: Len Brown +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + tools/power/x86/turbostat/turbostat.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +--- a/tools/power/x86/turbostat/turbostat.c ++++ b/tools/power/x86/turbostat/turbostat.c +@@ -3200,7 +3200,9 @@ void process_cpuid() + family = (fms >> 8) & 0xf; + model = (fms >> 4) & 0xf; + stepping = fms & 0xf; +- if (family == 6 || family == 0xf) ++ if (family == 0xf) ++ family += (fms >> 20) & 0xff; ++ if (family >= 6) + model += ((fms >> 16) & 0xf) << 4; + + if (debug) { diff --git a/queue-4.9/tools-usb-ffs-test-fix-build-on-big-endian-systems.patch b/queue-4.9/tools-usb-ffs-test-fix-build-on-big-endian-systems.patch new file mode 100644 index 00000000000..087b807354f --- /dev/null +++ b/queue-4.9/tools-usb-ffs-test-fix-build-on-big-endian-systems.patch @@ -0,0 +1,71 @@ +From foo@baz Sun Aug 26 09:16:12 CEST 2018 +From: Peter Senna Tschudin +Date: Tue, 10 Jul 2018 16:01:45 +0200 +Subject: tools: usb: ffs-test: Fix build on big endian systems + +From: Peter Senna Tschudin + +[ Upstream commit a2b22dddc7bb6110ac3b5ed1a60aa9279836fadb ] + +The tools/usb/ffs-test.c file defines cpu_to_le16/32 by using the C +library htole16/32 function calls. However, cpu_to_le16/32 are used when +initializing structures, i.e in a context where a function call is not +allowed. + +It works fine on little endian systems because htole16/32 are defined by +the C library as no-ops. But on big-endian systems, they are actually +doing something, which might involve calling a function, causing build +failures, such as: + + ffs-test.c:48:25: error: initializer element is not constant + #define cpu_to_le32(x) htole32(x) + ^~~~~~~ + ffs-test.c:128:12: note: in expansion of macro ‘cpu_to_le32’ + .magic = cpu_to_le32(FUNCTIONFS_DESCRIPTORS_MAGIC_V2), + ^~~~~~~~~~~ + +To solve this, we code cpu_to_le16/32 in a way that allows them to be +used when initializing structures. This fix was imported from +meta-openembedded/android-tools/fix-big-endian-build.patch written by +Thomas Petazzoni . + +CC: Thomas Petazzoni +Signed-off-by: Peter Senna Tschudin +Signed-off-by: Felipe Balbi +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + tools/usb/ffs-test.c | 19 ++++++++++++++++--- + 1 file changed, 16 insertions(+), 3 deletions(-) + +--- a/tools/usb/ffs-test.c ++++ b/tools/usb/ffs-test.c +@@ -44,12 +44,25 @@ + + /******************** Little Endian Handling ********************************/ + +-#define cpu_to_le16(x) htole16(x) +-#define cpu_to_le32(x) htole32(x) ++/* ++ * cpu_to_le16/32 are used when initializing structures, a context where a ++ * function call is not allowed. To solve this, we code cpu_to_le16/32 in a way ++ * that allows them to be used when initializing structures. ++ */ ++ ++#if __BYTE_ORDER == __LITTLE_ENDIAN ++#define cpu_to_le16(x) (x) ++#define cpu_to_le32(x) (x) ++#else ++#define cpu_to_le16(x) ((((x) >> 8) & 0xffu) | (((x) & 0xffu) << 8)) ++#define cpu_to_le32(x) \ ++ ((((x) & 0xff000000u) >> 24) | (((x) & 0x00ff0000u) >> 8) | \ ++ (((x) & 0x0000ff00u) << 8) | (((x) & 0x000000ffu) << 24)) ++#endif ++ + #define le32_to_cpu(x) le32toh(x) + #define le16_to_cpu(x) le16toh(x) + +- + /******************** Messages and Errors ***********************************/ + + static const char argv0[] = "ffs-test"; diff --git a/queue-4.9/usb-gadget-f_uac2-fix-endianness-of-struct-cntrl_-_lay3.patch b/queue-4.9/usb-gadget-f_uac2-fix-endianness-of-struct-cntrl_-_lay3.patch new file mode 100644 index 00000000000..b1b2024aaed --- /dev/null +++ b/queue-4.9/usb-gadget-f_uac2-fix-endianness-of-struct-cntrl_-_lay3.patch @@ -0,0 +1,96 @@ +From foo@baz Sun Aug 26 09:16:12 CEST 2018 +From: Eugeniu Rosca +Date: Mon, 2 Jul 2018 23:46:47 +0200 +Subject: usb: gadget: f_uac2: fix endianness of 'struct cntrl_*_lay3' + +From: Eugeniu Rosca + +[ Upstream commit eec24f2a0d4dc3b1d95a3ccd2feb523ede3ba775 ] + +The list [1] of commits doing endianness fixes in USB subsystem is long +due to below quote from USB spec Revision 2.0 from April 27, 2000: + +------------ +8.1 Byte/Bit Ordering + +Multiple byte fields in standard descriptors, requests, and responses +are interpreted as and moved over the bus in little-endian order, i.e. +LSB to MSB. +------------ + +This commit belongs to the same family. + +[1] Example of endianness fixes in USB subsystem: +commit 14e1d56cbea6 ("usb: gadget: f_uac2: endianness fixes.") +commit 42370b821168 ("usb: gadget: f_uac1: endianness fixes.") +commit 63afd5cc7877 ("USB: chaoskey: fix Alea quirk on big-endian hosts") +commit 74098c4ac782 ("usb: gadget: acm: fix endianness in notifications") +commit cdd7928df0d2 ("ACM gadget: fix endianness in notifications") +commit 323ece54e076 ("cdc-wdm: fix endianness bug in debug statements") +commit e102609f1072 ("usb: gadget: uvc: Fix endianness mismatches") + list goes on + +Fixes: 132fcb460839 ("usb: gadget: Add Audio Class 2.0 Driver") +Signed-off-by: Eugeniu Rosca +Reviewed-by: Ruslan Bilovol +Signed-off-by: Felipe Balbi + +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/gadget/function/f_uac2.c | 20 ++++++++++---------- + 1 file changed, 10 insertions(+), 10 deletions(-) + +--- a/drivers/usb/gadget/function/f_uac2.c ++++ b/drivers/usb/gadget/function/f_uac2.c +@@ -929,14 +929,14 @@ static struct usb_descriptor_header *hs_ + }; + + struct cntrl_cur_lay3 { +- __u32 dCUR; ++ __le32 dCUR; + }; + + struct cntrl_range_lay3 { +- __u16 wNumSubRanges; +- __u32 dMIN; +- __u32 dMAX; +- __u32 dRES; ++ __le16 wNumSubRanges; ++ __le32 dMIN; ++ __le32 dMAX; ++ __le32 dRES; + } __packed; + + static inline void +@@ -1285,9 +1285,9 @@ in_rq_cur(struct usb_function *fn, const + memset(&c, 0, sizeof(struct cntrl_cur_lay3)); + + if (entity_id == USB_IN_CLK_ID) +- c.dCUR = p_srate; ++ c.dCUR = cpu_to_le32(p_srate); + else if (entity_id == USB_OUT_CLK_ID) +- c.dCUR = c_srate; ++ c.dCUR = cpu_to_le32(c_srate); + + value = min_t(unsigned, w_length, sizeof c); + memcpy(req->buf, &c, value); +@@ -1325,15 +1325,15 @@ in_rq_range(struct usb_function *fn, con + + if (control_selector == UAC2_CS_CONTROL_SAM_FREQ) { + if (entity_id == USB_IN_CLK_ID) +- r.dMIN = p_srate; ++ r.dMIN = cpu_to_le32(p_srate); + else if (entity_id == USB_OUT_CLK_ID) +- r.dMIN = c_srate; ++ r.dMIN = cpu_to_le32(c_srate); + else + return -EOPNOTSUPP; + + r.dMAX = r.dMIN; + r.dRES = 0; +- r.wNumSubRanges = 1; ++ r.wNumSubRanges = cpu_to_le16(1); + + value = min_t(unsigned, w_length, sizeof r); + memcpy(req->buf, &r, value); diff --git a/queue-4.9/usb-gadget-r8a66597-fix-a-possible-sleep-in-atomic-context-bugs-in-r8a66597_queue.patch b/queue-4.9/usb-gadget-r8a66597-fix-a-possible-sleep-in-atomic-context-bugs-in-r8a66597_queue.patch new file mode 100644 index 00000000000..8f5f3ffad2f --- /dev/null +++ b/queue-4.9/usb-gadget-r8a66597-fix-a-possible-sleep-in-atomic-context-bugs-in-r8a66597_queue.patch @@ -0,0 +1,46 @@ +From foo@baz Sun Aug 26 09:16:12 CEST 2018 +From: Jia-Ju Bai +Date: Wed, 20 Jun 2018 11:55:08 +0800 +Subject: usb: gadget: r8a66597: Fix a possible sleep-in-atomic-context bugs in r8a66597_queue() + +From: Jia-Ju Bai + +[ Upstream commit f36b507c14c4b6e634463a610294e9cb0065c8ea ] + +The driver may sleep in an interrupt handler. +The function call path (from bottom to top) in Linux-4.16.7 is: + +[FUNC] r8a66597_queue(GFP_KERNEL) +drivers/usb/gadget/udc/r8a66597-udc.c, 1193: + r8a66597_queue in get_status +drivers/usb/gadget/udc/r8a66597-udc.c, 1301: + get_status in setup_packet +drivers/usb/gadget/udc/r8a66597-udc.c, 1381: + setup_packet in irq_control_stage +drivers/usb/gadget/udc/r8a66597-udc.c, 1508: + irq_control_stage in r8a66597_irq (interrupt handler) + +To fix this bug, GFP_KERNEL is replaced with GFP_ATOMIC. + +This bug is found by my static analysis tool (DSAC-2) and checked by +my code review. + +Signed-off-by: Jia-Ju Bai +Signed-off-by: Felipe Balbi +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/gadget/udc/r8a66597-udc.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/usb/gadget/udc/r8a66597-udc.c ++++ b/drivers/usb/gadget/udc/r8a66597-udc.c +@@ -1193,7 +1193,7 @@ __acquires(r8a66597->lock) + r8a66597->ep0_req->length = 2; + /* AV: what happens if we get called again before that gets through? */ + spin_unlock(&r8a66597->lock); +- r8a66597_queue(r8a66597->gadget.ep0, r8a66597->ep0_req, GFP_KERNEL); ++ r8a66597_queue(r8a66597->gadget.ep0, r8a66597->ep0_req, GFP_ATOMIC); + spin_lock(&r8a66597->lock); + } + diff --git a/queue-4.9/usb-gadget-r8a66597-fix-two-possible-sleep-in-atomic-context-bugs-in-init_controller.patch b/queue-4.9/usb-gadget-r8a66597-fix-two-possible-sleep-in-atomic-context-bugs-in-init_controller.patch new file mode 100644 index 00000000000..d73be8d3ebd --- /dev/null +++ b/queue-4.9/usb-gadget-r8a66597-fix-two-possible-sleep-in-atomic-context-bugs-in-init_controller.patch @@ -0,0 +1,57 @@ +From foo@baz Sun Aug 26 09:16:12 CEST 2018 +From: Jia-Ju Bai +Date: Wed, 20 Jun 2018 11:54:53 +0800 +Subject: usb: gadget: r8a66597: Fix two possible sleep-in-atomic-context bugs in init_controller() + +From: Jia-Ju Bai + +[ Upstream commit 0602088b10a7c0b4e044a810678ef93d7cc5bf48 ] + +The driver may sleep with holding a spinlock. +The function call paths (from bottom to top) in Linux-4.16.7 are: + +[FUNC] msleep +drivers/usb/gadget/udc/r8a66597-udc.c, 839: + msleep in init_controller +drivers/usb/gadget/udc/r8a66597-udc.c, 96: + init_controller in r8a66597_usb_disconnect +drivers/usb/gadget/udc/r8a66597-udc.c, 93: + spin_lock in r8a66597_usb_disconnect + +[FUNC] msleep +drivers/usb/gadget/udc/r8a66597-udc.c, 835: + msleep in init_controller +drivers/usb/gadget/udc/r8a66597-udc.c, 96: + init_controller in r8a66597_usb_disconnect +drivers/usb/gadget/udc/r8a66597-udc.c, 93: + spin_lock in r8a66597_usb_disconnect + +To fix these bugs, msleep() is replaced with mdelay(). + +This bug is found by my static analysis tool (DSAC-2) and checked by +my code review. + +Signed-off-by: Jia-Ju Bai +Signed-off-by: Felipe Balbi +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/gadget/udc/r8a66597-udc.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/usb/gadget/udc/r8a66597-udc.c ++++ b/drivers/usb/gadget/udc/r8a66597-udc.c +@@ -835,11 +835,11 @@ static void init_controller(struct r8a66 + + r8a66597_bset(r8a66597, XCKE, SYSCFG0); + +- msleep(3); ++ mdelay(3); + + r8a66597_bset(r8a66597, PLLC, SYSCFG0); + +- msleep(1); ++ mdelay(1); + + r8a66597_bset(r8a66597, SCKE, SYSCFG0); + diff --git a/queue-4.9/usb-phy-fix-ppc64-build-errors-in-phy-fsl-usb.c.patch b/queue-4.9/usb-phy-fix-ppc64-build-errors-in-phy-fsl-usb.c.patch new file mode 100644 index 00000000000..8adbba74bc1 --- /dev/null +++ b/queue-4.9/usb-phy-fix-ppc64-build-errors-in-phy-fsl-usb.c.patch @@ -0,0 +1,71 @@ +From foo@baz Sun Aug 26 09:16:12 CEST 2018 +From: Randy Dunlap +Date: Sun, 15 Jul 2018 10:37:37 -0700 +Subject: usb/phy: fix PPC64 build errors in phy-fsl-usb.c + +From: Randy Dunlap + +[ Upstream commit a39ba90a1cc7010edb0a7132e1b67f3d80b994e9 ] + +Fix build errors when built for PPC64: +These variables are only used on PPC32 so they don't need to be +initialized for PPC64. + +../drivers/usb/phy/phy-fsl-usb.c: In function 'usb_otg_start': +../drivers/usb/phy/phy-fsl-usb.c:865:3: error: '_fsl_readl' undeclared (first use in this function); did you mean 'fsl_readl'? + _fsl_readl = _fsl_readl_be; +../drivers/usb/phy/phy-fsl-usb.c:865:16: error: '_fsl_readl_be' undeclared (first use in this function); did you mean 'fsl_readl'? + _fsl_readl = _fsl_readl_be; +../drivers/usb/phy/phy-fsl-usb.c:866:3: error: '_fsl_writel' undeclared (first use in this function); did you mean 'fsl_writel'? + _fsl_writel = _fsl_writel_be; +../drivers/usb/phy/phy-fsl-usb.c:866:17: error: '_fsl_writel_be' undeclared (first use in this function); did you mean 'fsl_writel'? + _fsl_writel = _fsl_writel_be; +../drivers/usb/phy/phy-fsl-usb.c:868:16: error: '_fsl_readl_le' undeclared (first use in this function); did you mean 'fsl_readl'? + _fsl_readl = _fsl_readl_le; +../drivers/usb/phy/phy-fsl-usb.c:869:17: error: '_fsl_writel_le' undeclared (first use in this function); did you mean 'fsl_writel'? + _fsl_writel = _fsl_writel_le; + +and the sysfs "show" function return type should be ssize_t, not int: + +../drivers/usb/phy/phy-fsl-usb.c:1042:49: error: initialization of 'ssize_t (*)(struct device *, struct device_attribute *, char *)' {aka 'long int (*)(struct device *, struct device_attribute *, char *)'} from incompatible pointer type 'int (*)(struct device *, struct device_attribute *, char *)' [-Werror=incompatible-pointer-types] + static DEVICE_ATTR(fsl_usb2_otg_state, S_IRUGO, show_fsl_usb2_otg_state, NULL); + +Signed-off-by: Randy Dunlap +Cc: Felipe Balbi +Cc: linux-usb@vger.kernel.org +Cc: Michael Ellerman +Cc: linuxppc-dev@lists.ozlabs.org +Signed-off-by: Felipe Balbi +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/phy/phy-fsl-usb.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +--- a/drivers/usb/phy/phy-fsl-usb.c ++++ b/drivers/usb/phy/phy-fsl-usb.c +@@ -879,6 +879,7 @@ int usb_otg_start(struct platform_device + if (pdata->init && pdata->init(pdev) != 0) + return -EINVAL; + ++#ifdef CONFIG_PPC32 + if (pdata->big_endian_mmio) { + _fsl_readl = _fsl_readl_be; + _fsl_writel = _fsl_writel_be; +@@ -886,6 +887,7 @@ int usb_otg_start(struct platform_device + _fsl_readl = _fsl_readl_le; + _fsl_writel = _fsl_writel_le; + } ++#endif + + /* request irq */ + p_otg->irq = platform_get_irq(pdev, 0); +@@ -976,7 +978,7 @@ int usb_otg_start(struct platform_device + /* + * state file in sysfs + */ +-static int show_fsl_usb2_otg_state(struct device *dev, ++static ssize_t show_fsl_usb2_otg_state(struct device *dev, + struct device_attribute *attr, char *buf) + { + struct otg_fsm *fsm = &fsl_otg_dev->fsm; diff --git a/queue-4.9/vti6-fix-pmtu-caching-and-reporting-on-xmit.patch b/queue-4.9/vti6-fix-pmtu-caching-and-reporting-on-xmit.patch new file mode 100644 index 00000000000..7570bb38c21 --- /dev/null +++ b/queue-4.9/vti6-fix-pmtu-caching-and-reporting-on-xmit.patch @@ -0,0 +1,55 @@ +From foo@baz Sun Aug 26 09:16:12 CEST 2018 +From: Eyal Birger +Date: Thu, 7 Jun 2018 10:11:02 +0300 +Subject: vti6: fix PMTU caching and reporting on xmit + +From: Eyal Birger + +[ Upstream commit d6990976af7c5d8f55903bfb4289b6fb030bf754 ] + +When setting the skb->dst before doing the MTU check, the route PMTU +caching and reporting is done on the new dst which is about to be +released. + +Instead, PMTU handling should be done using the original dst. + +This is aligned with IPv4 VTI. + +Fixes: ccd740cbc6 ("vti6: Add pmtu handling to vti6_xmit.") +Signed-off-by: Eyal Birger +Signed-off-by: Steffen Klassert +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + net/ipv6/ip6_vti.c | 11 ++++++----- + 1 file changed, 6 insertions(+), 5 deletions(-) + +--- a/net/ipv6/ip6_vti.c ++++ b/net/ipv6/ip6_vti.c +@@ -480,10 +480,6 @@ vti6_xmit(struct sk_buff *skb, struct ne + goto tx_err_dst_release; + } + +- skb_scrub_packet(skb, !net_eq(t->net, dev_net(dev))); +- skb_dst_set(skb, dst); +- skb->dev = skb_dst(skb)->dev; +- + mtu = dst_mtu(dst); + if (!skb->ignore_df && skb->len > mtu) { + skb_dst(skb)->ops->update_pmtu(dst, NULL, skb, mtu); +@@ -498,9 +494,14 @@ vti6_xmit(struct sk_buff *skb, struct ne + htonl(mtu)); + } + +- return -EMSGSIZE; ++ err = -EMSGSIZE; ++ goto tx_err_dst_release; + } + ++ skb_scrub_packet(skb, !net_eq(t->net, dev_net(dev))); ++ skb_dst_set(skb, dst); ++ skb->dev = skb_dst(skb)->dev; ++ + err = dst_output(t->net, skb->sk, skb); + if (net_xmit_eval(err) == 0) { + struct pcpu_sw_netstats *tstats = this_cpu_ptr(dev->tstats); diff --git a/queue-4.9/x86-boot-fix-if_changed-build-flip-flop-bug.patch b/queue-4.9/x86-boot-fix-if_changed-build-flip-flop-bug.patch new file mode 100644 index 00000000000..771cbbdbc2c --- /dev/null +++ b/queue-4.9/x86-boot-fix-if_changed-build-flip-flop-bug.patch @@ -0,0 +1,83 @@ +From foo@baz Sun Aug 26 09:16:12 CEST 2018 +From: Kees Cook +Date: Tue, 24 Jul 2018 16:08:27 -0700 +Subject: x86/boot: Fix if_changed build flip/flop bug + +From: Kees Cook + +[ Upstream commit 92a4728608a8fd228c572bc8ff50dd98aa0ddf2a ] + +Dirk Gouders reported that two consecutive "make" invocations on an +already compiled tree will show alternating behaviors: + +$ make + CALL scripts/checksyscalls.sh + DESCEND objtool + CHK include/generated/compile.h + DATAREL arch/x86/boot/compressed/vmlinux +Kernel: arch/x86/boot/bzImage is ready (#48) + Building modules, stage 2. + MODPOST 165 modules + +$ make + CALL scripts/checksyscalls.sh + DESCEND objtool + CHK include/generated/compile.h + LD arch/x86/boot/compressed/vmlinux + ZOFFSET arch/x86/boot/zoffset.h + AS arch/x86/boot/header.o + LD arch/x86/boot/setup.elf + OBJCOPY arch/x86/boot/setup.bin + OBJCOPY arch/x86/boot/vmlinux.bin + BUILD arch/x86/boot/bzImage +Setup is 15644 bytes (padded to 15872 bytes). +System is 6663 kB +CRC 3eb90f40 +Kernel: arch/x86/boot/bzImage is ready (#48) + Building modules, stage 2. + MODPOST 165 modules + +He bisected it back to: + + commit 98f78525371b ("x86/boot: Refuse to build with data relocations") + +The root cause was the use of the "if_changed" kbuild function multiple +times for the same target. It was designed to only be used once per +target, otherwise it will effectively always trigger, flipping back and +forth between the two commands getting recorded by "if_changed". Instead, +this patch merges the two commands into a single function to get stable +build artifacts (i.e. .vmlinux.cmd), and a single build behavior. + +Bisected-and-Reported-by: Dirk Gouders +Fix-Suggested-by: Masahiro Yamada +Signed-off-by: Kees Cook +Reviewed-by: Masahiro Yamada +Cc: Linus Torvalds +Cc: Peter Zijlstra +Cc: Thomas Gleixner +Link: http://lkml.kernel.org/r/20180724230827.GA37823@beast +Signed-off-by: Ingo Molnar +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + arch/x86/boot/compressed/Makefile | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +--- a/arch/x86/boot/compressed/Makefile ++++ b/arch/x86/boot/compressed/Makefile +@@ -101,9 +101,13 @@ define cmd_check_data_rel + done + endef + ++# We need to run two commands under "if_changed", so merge them into a ++# single invocation. ++quiet_cmd_check-and-link-vmlinux = LD $@ ++ cmd_check-and-link-vmlinux = $(cmd_check_data_rel); $(cmd_ld) ++ + $(obj)/vmlinux: $(vmlinux-objs-y) FORCE +- $(call if_changed,check_data_rel) +- $(call if_changed,ld) ++ $(call if_changed,check-and-link-vmlinux) + + OBJCOPYFLAGS_vmlinux.bin := -R .comment -S + $(obj)/vmlinux.bin: vmlinux FORCE diff --git a/queue-4.9/xfrm-fix-missing-dst_release-after-policy-blocking-lbcast-and-multicast.patch b/queue-4.9/xfrm-fix-missing-dst_release-after-policy-blocking-lbcast-and-multicast.patch new file mode 100644 index 00000000000..47c559b241f --- /dev/null +++ b/queue-4.9/xfrm-fix-missing-dst_release-after-policy-blocking-lbcast-and-multicast.patch @@ -0,0 +1,67 @@ +From foo@baz Sun Aug 26 09:16:12 CEST 2018 +From: Tommi Rantala +Date: Thu, 21 Jun 2018 09:30:47 +0300 +Subject: xfrm: fix missing dst_release() after policy blocking lbcast and multicast + +From: Tommi Rantala + +[ Upstream commit 8cc88773855f988d6a3bbf102bbd9dd9c828eb81 ] + +Fix missing dst_release() when local broadcast or multicast traffic is +xfrm policy blocked. + +For IPv4 this results to dst leak: ip_route_output_flow() allocates +dst_entry via __ip_route_output_key() and passes it to +xfrm_lookup_route(). xfrm_lookup returns ERR_PTR(-EPERM) that is +propagated. The dst that was allocated is never released. + +IPv4 local broadcast testcase: + ping -b 192.168.1.255 & + sleep 1 + ip xfrm policy add src 0.0.0.0/0 dst 192.168.1.255/32 dir out action block + +IPv4 multicast testcase: + ping 224.0.0.1 & + sleep 1 + ip xfrm policy add src 0.0.0.0/0 dst 224.0.0.1/32 dir out action block + +For IPv6 the missing dst_release() causes trouble e.g. when used in netns: + ip netns add TEST + ip netns exec TEST ip link set lo up + ip link add dummy0 type dummy + ip link set dev dummy0 netns TEST + ip netns exec TEST ip addr add fd00::1111 dev dummy0 + ip netns exec TEST ip link set dummy0 up + ip netns exec TEST ping -6 -c 5 ff02::1%dummy0 & + sleep 1 + ip netns exec TEST ip xfrm policy add src ::/0 dst ff02::1 dir out action block + wait + ip netns del TEST + +After netns deletion we see: +[ 258.239097] unregister_netdevice: waiting for lo to become free. Usage count = 2 +[ 268.279061] unregister_netdevice: waiting for lo to become free. Usage count = 2 +[ 278.367018] unregister_netdevice: waiting for lo to become free. Usage count = 2 +[ 288.375259] unregister_netdevice: waiting for lo to become free. Usage count = 2 + +Fixes: ac37e2515c1a ("xfrm: release dst_orig in case of error in xfrm_lookup()") +Signed-off-by: Tommi Rantala +Signed-off-by: Steffen Klassert +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + net/xfrm/xfrm_policy.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/net/xfrm/xfrm_policy.c ++++ b/net/xfrm/xfrm_policy.c +@@ -2354,6 +2354,9 @@ struct dst_entry *xfrm_lookup_route(stru + if (IS_ERR(dst) && PTR_ERR(dst) == -EREMOTE) + return make_blackhole(net, dst_orig->ops->family, dst_orig); + ++ if (IS_ERR(dst)) ++ dst_release(dst_orig); ++ + return dst; + } + EXPORT_SYMBOL(xfrm_lookup_route); diff --git a/queue-4.9/xfrm-free-skb-if-nlsk-pointer-is-null.patch b/queue-4.9/xfrm-free-skb-if-nlsk-pointer-is-null.patch new file mode 100644 index 00000000000..c7ed3ba7b0b --- /dev/null +++ b/queue-4.9/xfrm-free-skb-if-nlsk-pointer-is-null.patch @@ -0,0 +1,40 @@ +From foo@baz Sun Aug 26 09:16:12 CEST 2018 +From: Florian Westphal +Date: Mon, 25 Jun 2018 14:00:07 +0200 +Subject: xfrm: free skb if nlsk pointer is NULL + +From: Florian Westphal + +[ Upstream commit 86126b77dcd551ce223e7293bb55854e3df05646 ] + +nlmsg_multicast() always frees the skb, so in case we cannot call +it we must do that ourselves. + +Fixes: 21ee543edc0dea ("xfrm: fix race between netns cleanup and state expire notification") +Signed-off-by: Florian Westphal +Signed-off-by: Steffen Klassert +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + net/xfrm/xfrm_user.c | 10 ++++++---- + 1 file changed, 6 insertions(+), 4 deletions(-) + +--- a/net/xfrm/xfrm_user.c ++++ b/net/xfrm/xfrm_user.c +@@ -984,10 +984,12 @@ static inline int xfrm_nlmsg_multicast(s + { + struct sock *nlsk = rcu_dereference(net->xfrm.nlsk); + +- if (nlsk) +- return nlmsg_multicast(nlsk, skb, pid, group, GFP_ATOMIC); +- else +- return -1; ++ if (!nlsk) { ++ kfree_skb(skb); ++ return -EPIPE; ++ } ++ ++ return nlmsg_multicast(nlsk, skb, pid, group, GFP_ATOMIC); + } + + static inline size_t xfrm_spdinfo_msgsize(void) diff --git a/queue-4.9/zswap-re-check-zswap_is_full-after-do-zswap_shrink.patch b/queue-4.9/zswap-re-check-zswap_is_full-after-do-zswap_shrink.patch new file mode 100644 index 00000000000..96ce48f1ff9 --- /dev/null +++ b/queue-4.9/zswap-re-check-zswap_is_full-after-do-zswap_shrink.patch @@ -0,0 +1,65 @@ +From foo@baz Sun Aug 26 09:16:12 CEST 2018 +From: Li Wang +Date: Thu, 26 Jul 2018 16:37:42 -0700 +Subject: zswap: re-check zswap_is_full() after do zswap_shrink() + +From: Li Wang + +[ Upstream commit 16e536ef47f567289a5699abee9ff7bb304bc12d ] + +/sys/../zswap/stored_pages keeps rising in a zswap test with +"zswap.max_pool_percent=0" parameter. But it should not compress or +store pages any more since there is no space in the compressed pool. + +Reproduce steps: + 1. Boot kernel with "zswap.enabled=1" + 2. Set the max_pool_percent to 0 + # echo 0 > /sys/module/zswap/parameters/max_pool_percent + 3. Do memory stress test to see if some pages have been compressed + # stress --vm 1 --vm-bytes $mem_available"M" --timeout 60s + 4. Watching the 'stored_pages' number increasing or not + +The root cause is: + + When zswap_max_pool_percent is set to 0 via kernel parameter, + zswap_is_full() will always return true due to zswap_shrink(). But if + the shinking is able to reclain a page successfully the code then + proceeds to compressing/storing another page, so the value of + stored_pages will keep changing. + +To solve the issue, this patch adds a zswap_is_full() check again after + zswap_shrink() to make sure it's now under the max_pool_percent, and to + not compress/store if we reached the limit. + +Link: http://lkml.kernel.org/r/20180530103936.17812-1-liwang@redhat.com +Signed-off-by: Li Wang +Acked-by: Dan Streetman +Cc: Seth Jennings +Cc: Huang Ying +Cc: Yu Zhao +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + mm/zswap.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +--- a/mm/zswap.c ++++ b/mm/zswap.c +@@ -1018,6 +1018,15 @@ static int zswap_frontswap_store(unsigne + ret = -ENOMEM; + goto reject; + } ++ ++ /* A second zswap_is_full() check after ++ * zswap_shrink() to make sure it's now ++ * under the max_pool_percent ++ */ ++ if (zswap_is_full()) { ++ ret = -ENOMEM; ++ goto reject; ++ } + } + + /* allocate entry */