From: Sasha Levin Date: Sun, 9 Oct 2022 02:12:29 +0000 (-0400) Subject: Fixes for 4.14 X-Git-Tag: v6.0.1~31^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3f59ce3743c77f7bff689fa1a401906d833632eb;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 4.14 Signed-off-by: Sasha Levin --- diff --git a/queue-4.14/arm-dts-fix-moxa-sdio-compatible-remove-sdhci-misnom.patch b/queue-4.14/arm-dts-fix-moxa-sdio-compatible-remove-sdhci-misnom.patch new file mode 100644 index 00000000000..eb835f6e130 --- /dev/null +++ b/queue-4.14/arm-dts-fix-moxa-sdio-compatible-remove-sdhci-misnom.patch @@ -0,0 +1,77 @@ +From d7f214e776393ca11c2c42f8e01f7798149e6e68 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 7 Sep 2022 20:53:41 +0300 +Subject: ARM: dts: fix Moxa SDIO 'compatible', remove 'sdhci' misnomer + +From: Sergei Antonov + +[ Upstream commit 02181e68275d28cab3c3f755852770367f1bc229 ] + +Driver moxart-mmc.c has .compatible = "moxa,moxart-mmc". + +But moxart .dts/.dtsi and the documentation file moxa,moxart-dma.txt +contain compatible = "moxa,moxart-sdhci". + +Change moxart .dts/.dtsi files and moxa,moxart-dma.txt to match the driver. + +Replace 'sdhci' with 'mmc' in names too, since SDHCI is a different +controller from FTSDC010. + +Suggested-by: Arnd Bergmann +Signed-off-by: Sergei Antonov +Cc: Jonas Jensen +Link: https://lore.kernel.org/r/20220907175341.1477383-1-saproj@gmail.com' +Signed-off-by: Arnd Bergmann +Signed-off-by: Sasha Levin +--- + Documentation/devicetree/bindings/dma/moxa,moxart-dma.txt | 4 ++-- + arch/arm/boot/dts/moxart-uc7112lx.dts | 2 +- + arch/arm/boot/dts/moxart.dtsi | 4 ++-- + 3 files changed, 5 insertions(+), 5 deletions(-) + +diff --git a/Documentation/devicetree/bindings/dma/moxa,moxart-dma.txt b/Documentation/devicetree/bindings/dma/moxa,moxart-dma.txt +index 8a9f3559335b..7e14e26676ec 100644 +--- a/Documentation/devicetree/bindings/dma/moxa,moxart-dma.txt ++++ b/Documentation/devicetree/bindings/dma/moxa,moxart-dma.txt +@@ -34,8 +34,8 @@ Example: + Use specific request line passing from dma + For example, MMC request line is 5 + +- sdhci: sdhci@98e00000 { +- compatible = "moxa,moxart-sdhci"; ++ mmc: mmc@98e00000 { ++ compatible = "moxa,moxart-mmc"; + reg = <0x98e00000 0x5C>; + interrupts = <5 0>; + clocks = <&clk_apb>; +diff --git a/arch/arm/boot/dts/moxart-uc7112lx.dts b/arch/arm/boot/dts/moxart-uc7112lx.dts +index 4a962a26482d..59d8775a3a93 100644 +--- a/arch/arm/boot/dts/moxart-uc7112lx.dts ++++ b/arch/arm/boot/dts/moxart-uc7112lx.dts +@@ -80,7 +80,7 @@ &clk_pll { + clocks = <&ref12>; + }; + +-&sdhci { ++&mmc { + status = "okay"; + }; + +diff --git a/arch/arm/boot/dts/moxart.dtsi b/arch/arm/boot/dts/moxart.dtsi +index da7b3237bfe9..804a2bc6ec82 100644 +--- a/arch/arm/boot/dts/moxart.dtsi ++++ b/arch/arm/boot/dts/moxart.dtsi +@@ -93,8 +93,8 @@ watchdog: watchdog@98500000 { + clock-names = "PCLK"; + }; + +- sdhci: sdhci@98e00000 { +- compatible = "moxa,moxart-sdhci"; ++ mmc: mmc@98e00000 { ++ compatible = "moxa,moxart-mmc"; + reg = <0x98e00000 0x5C>; + interrupts = <5 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&clk_apb>; +-- +2.35.1 + diff --git a/queue-4.14/dmaengine-xilinx_dma-cleanup-for-fetching-xlnx-num-f.patch b/queue-4.14/dmaengine-xilinx_dma-cleanup-for-fetching-xlnx-num-f.patch new file mode 100644 index 00000000000..411d7ca0fbf --- /dev/null +++ b/queue-4.14/dmaengine-xilinx_dma-cleanup-for-fetching-xlnx-num-f.patch @@ -0,0 +1,35 @@ +From dd3a3dc2d1216077cc0c2f9a499a7aacd0bfef5a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 17 Aug 2022 11:41:24 +0530 +Subject: dmaengine: xilinx_dma: cleanup for fetching xlnx,num-fstores property + +From: Swati Agarwal + +[ Upstream commit 462bce790e6a7e68620a4ce260cc38f7ed0255d5 ] + +Free the allocated resources for missing xlnx,num-fstores property. + +Signed-off-by: Swati Agarwal +Link: https://lore.kernel.org/r/20220817061125.4720-3-swati.agarwal@xilinx.com +Signed-off-by: Vinod Koul +Signed-off-by: Sasha Levin +--- + drivers/dma/xilinx/xilinx_dma.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/dma/xilinx/xilinx_dma.c b/drivers/dma/xilinx/xilinx_dma.c +index 3c2084766a31..9319349e69d2 100644 +--- a/drivers/dma/xilinx/xilinx_dma.c ++++ b/drivers/dma/xilinx/xilinx_dma.c +@@ -2565,7 +2565,7 @@ static int xilinx_dma_probe(struct platform_device *pdev) + if (err < 0) { + dev_err(xdev->dev, + "missing xlnx,num-fstores property\n"); +- return err; ++ goto disable_clks; + } + + err = of_property_read_u32(node, "xlnx,flush-fsync", +-- +2.35.1 + diff --git a/queue-4.14/dmaengine-xilinx_dma-report-error-in-case-of-dma_set.patch b/queue-4.14/dmaengine-xilinx_dma-report-error-in-case-of-dma_set.patch new file mode 100644 index 00000000000..5574cc45544 --- /dev/null +++ b/queue-4.14/dmaengine-xilinx_dma-report-error-in-case-of-dma_set.patch @@ -0,0 +1,47 @@ +From 457d0183d3e3c670c582e64e7b3367ec50bb1fb8 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 17 Aug 2022 11:41:25 +0530 +Subject: dmaengine: xilinx_dma: Report error in case of + dma_set_mask_and_coherent API failure + +From: Swati Agarwal + +[ Upstream commit 8f2b6bc79c32f0fa60df000ae387a790ec80eae9 ] + +The driver does not handle the failure case while calling +dma_set_mask_and_coherent API. + +In case of failure, capture the return value of API and then report an +error. + +Addresses-coverity: Unchecked return value (CHECKED_RETURN) + +Signed-off-by: Swati Agarwal +Reviewed-by: Radhey Shyam Pandey +Link: https://lore.kernel.org/r/20220817061125.4720-4-swati.agarwal@xilinx.com +Signed-off-by: Vinod Koul +Signed-off-by: Sasha Levin +--- + drivers/dma/xilinx/xilinx_dma.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/drivers/dma/xilinx/xilinx_dma.c b/drivers/dma/xilinx/xilinx_dma.c +index 9319349e69d2..b4d00bc461db 100644 +--- a/drivers/dma/xilinx/xilinx_dma.c ++++ b/drivers/dma/xilinx/xilinx_dma.c +@@ -2585,7 +2585,11 @@ static int xilinx_dma_probe(struct platform_device *pdev) + xdev->ext_addr = false; + + /* Set the dma mask bits */ +- dma_set_mask_and_coherent(xdev->dev, DMA_BIT_MASK(addr_width)); ++ err = dma_set_mask_and_coherent(xdev->dev, DMA_BIT_MASK(addr_width)); ++ if (err < 0) { ++ dev_err(xdev->dev, "DMA mask error %d\n", err); ++ goto disable_clks; ++ } + + /* Initialize the DMA engine */ + xdev->common.dev = &pdev->dev; +-- +2.35.1 + diff --git a/queue-4.14/net-ieee802154-fix-uninit-value-bug-in-dgram_sendmsg.patch b/queue-4.14/net-ieee802154-fix-uninit-value-bug-in-dgram_sendmsg.patch new file mode 100644 index 00000000000..6e2ebf99485 --- /dev/null +++ b/queue-4.14/net-ieee802154-fix-uninit-value-bug-in-dgram_sendmsg.patch @@ -0,0 +1,173 @@ +From 8f4b1c97c14c2d67b256e54349331d07431b2c49 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 8 Sep 2022 20:19:27 +0800 +Subject: net/ieee802154: fix uninit value bug in dgram_sendmsg + +From: Haimin Zhang + +[ Upstream commit 94160108a70c8af17fa1484a37e05181c0e094af ] + +There is uninit value bug in dgram_sendmsg function in +net/ieee802154/socket.c when the length of valid data pointed by the +msg->msg_name isn't verified. + +We introducing a helper function ieee802154_sockaddr_check_size to +check namelen. First we check there is addr_type in ieee802154_addr_sa. +Then, we check namelen according to addr_type. + +Also fixed in raw_bind, dgram_bind, dgram_connect. + +Signed-off-by: Haimin Zhang +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + include/net/ieee802154_netdev.h | 37 +++++++++++++++++++++++++++++ + net/ieee802154/socket.c | 42 ++++++++++++++++++--------------- + 2 files changed, 60 insertions(+), 19 deletions(-) + +diff --git a/include/net/ieee802154_netdev.h b/include/net/ieee802154_netdev.h +index c4b31601cd53..fd1665baa179 100644 +--- a/include/net/ieee802154_netdev.h ++++ b/include/net/ieee802154_netdev.h +@@ -23,6 +23,22 @@ + #ifndef IEEE802154_NETDEVICE_H + #define IEEE802154_NETDEVICE_H + ++#define IEEE802154_REQUIRED_SIZE(struct_type, member) \ ++ (offsetof(typeof(struct_type), member) + \ ++ sizeof(((typeof(struct_type) *)(NULL))->member)) ++ ++#define IEEE802154_ADDR_OFFSET \ ++ offsetof(typeof(struct sockaddr_ieee802154), addr) ++ ++#define IEEE802154_MIN_NAMELEN (IEEE802154_ADDR_OFFSET + \ ++ IEEE802154_REQUIRED_SIZE(struct ieee802154_addr_sa, addr_type)) ++ ++#define IEEE802154_NAMELEN_SHORT (IEEE802154_ADDR_OFFSET + \ ++ IEEE802154_REQUIRED_SIZE(struct ieee802154_addr_sa, short_addr)) ++ ++#define IEEE802154_NAMELEN_LONG (IEEE802154_ADDR_OFFSET + \ ++ IEEE802154_REQUIRED_SIZE(struct ieee802154_addr_sa, hwaddr)) ++ + #include + #include + #include +@@ -173,6 +189,27 @@ static inline void ieee802154_devaddr_to_raw(void *raw, __le64 addr) + memcpy(raw, &temp, IEEE802154_ADDR_LEN); + } + ++static inline int ++ieee802154_sockaddr_check_size(struct sockaddr_ieee802154 *daddr, int len) ++{ ++ struct ieee802154_addr_sa *sa; ++ ++ sa = &daddr->addr; ++ if (len < IEEE802154_MIN_NAMELEN) ++ return -EINVAL; ++ switch (sa->addr_type) { ++ case IEEE802154_ADDR_SHORT: ++ if (len < IEEE802154_NAMELEN_SHORT) ++ return -EINVAL; ++ break; ++ case IEEE802154_ADDR_LONG: ++ if (len < IEEE802154_NAMELEN_LONG) ++ return -EINVAL; ++ break; ++ } ++ return 0; ++} ++ + static inline void ieee802154_addr_from_sa(struct ieee802154_addr *a, + const struct ieee802154_addr_sa *sa) + { +diff --git a/net/ieee802154/socket.c b/net/ieee802154/socket.c +index 9d46d9462129..16bf114118c3 100644 +--- a/net/ieee802154/socket.c ++++ b/net/ieee802154/socket.c +@@ -212,8 +212,9 @@ static int raw_bind(struct sock *sk, struct sockaddr *_uaddr, int len) + int err = 0; + struct net_device *dev = NULL; + +- if (len < sizeof(*uaddr)) +- return -EINVAL; ++ err = ieee802154_sockaddr_check_size(uaddr, len); ++ if (err < 0) ++ return err; + + uaddr = (struct sockaddr_ieee802154 *)_uaddr; + if (uaddr->family != AF_IEEE802154) +@@ -506,7 +507,8 @@ static int dgram_bind(struct sock *sk, struct sockaddr *uaddr, int len) + + ro->bound = 0; + +- if (len < sizeof(*addr)) ++ err = ieee802154_sockaddr_check_size(addr, len); ++ if (err < 0) + goto out; + + if (addr->family != AF_IEEE802154) +@@ -577,8 +579,9 @@ static int dgram_connect(struct sock *sk, struct sockaddr *uaddr, + struct dgram_sock *ro = dgram_sk(sk); + int err = 0; + +- if (len < sizeof(*addr)) +- return -EINVAL; ++ err = ieee802154_sockaddr_check_size(addr, len); ++ if (err < 0) ++ return err; + + if (addr->family != AF_IEEE802154) + return -EINVAL; +@@ -617,6 +620,7 @@ static int dgram_sendmsg(struct sock *sk, struct msghdr *msg, size_t size) + struct ieee802154_mac_cb *cb; + struct dgram_sock *ro = dgram_sk(sk); + struct ieee802154_addr dst_addr; ++ DECLARE_SOCKADDR(struct sockaddr_ieee802154*, daddr, msg->msg_name); + int hlen, tlen; + int err; + +@@ -625,10 +629,20 @@ static int dgram_sendmsg(struct sock *sk, struct msghdr *msg, size_t size) + return -EOPNOTSUPP; + } + +- if (!ro->connected && !msg->msg_name) +- return -EDESTADDRREQ; +- else if (ro->connected && msg->msg_name) +- return -EISCONN; ++ if (msg->msg_name) { ++ if (ro->connected) ++ return -EISCONN; ++ if (msg->msg_namelen < IEEE802154_MIN_NAMELEN) ++ return -EINVAL; ++ err = ieee802154_sockaddr_check_size(daddr, msg->msg_namelen); ++ if (err < 0) ++ return err; ++ ieee802154_addr_from_sa(&dst_addr, &daddr->addr); ++ } else { ++ if (!ro->connected) ++ return -EDESTADDRREQ; ++ dst_addr = ro->dst_addr; ++ } + + if (!ro->bound) + dev = dev_getfirstbyhwtype(sock_net(sk), ARPHRD_IEEE802154); +@@ -664,16 +678,6 @@ static int dgram_sendmsg(struct sock *sk, struct msghdr *msg, size_t size) + cb = mac_cb_init(skb); + cb->type = IEEE802154_FC_TYPE_DATA; + cb->ackreq = ro->want_ack; +- +- if (msg->msg_name) { +- DECLARE_SOCKADDR(struct sockaddr_ieee802154*, +- daddr, msg->msg_name); +- +- ieee802154_addr_from_sa(&dst_addr, &daddr->addr); +- } else { +- dst_addr = ro->dst_addr; +- } +- + cb->secen = ro->secen; + cb->secen_override = ro->secen_override; + cb->seclevel = ro->seclevel; +-- +2.35.1 + diff --git a/queue-4.14/series b/queue-4.14/series index fd195175f94..ac7600ff722 100644 --- a/queue-4.14/series +++ b/queue-4.14/series @@ -22,3 +22,9 @@ i2c-dev-prevent-zero_size_ptr-deref-in-i2cdev_ioctl_rdwr.patch arm-fix-function-graph-tracer-and-unwinder-dependencies.patch wait_on_bit-add-an-acquire-memory-barrier.patch provide-arch_test_bit_acquire-for-architectures-that-define-test_bit.patch +dmaengine-xilinx_dma-cleanup-for-fetching-xlnx-num-f.patch +dmaengine-xilinx_dma-report-error-in-case-of-dma_set.patch +arm-dts-fix-moxa-sdio-compatible-remove-sdhci-misnom.patch +net-ieee802154-fix-uninit-value-bug-in-dgram_sendmsg.patch +um-cleanup-syscall_handler_t-cast-in-syscalls_32.h.patch +um-cleanup-compiler-warning-in-arch-x86-um-tls_32.c.patch diff --git a/queue-4.14/um-cleanup-compiler-warning-in-arch-x86-um-tls_32.c.patch b/queue-4.14/um-cleanup-compiler-warning-in-arch-x86-um-tls_32.c.patch new file mode 100644 index 00000000000..4a5edcae401 --- /dev/null +++ b/queue-4.14/um-cleanup-compiler-warning-in-arch-x86-um-tls_32.c.patch @@ -0,0 +1,70 @@ +From 922e7da09ac62974b5e1762dfd5dd6cc6ad14247 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 26 Aug 2022 15:29:31 +0000 +Subject: um: Cleanup compiler warning in arch/x86/um/tls_32.c + +From: Lukas Straub + +[ Upstream commit d27fff3499671dc23a08efd01cdb8b3764a391c4 ] + +arch.tls_array is statically allocated so checking for NULL doesn't +make sense. This causes the compiler warning below. + +Remove the checks to silence these warnings. + +../arch/x86/um/tls_32.c: In function 'get_free_idx': +../arch/x86/um/tls_32.c:68:13: warning: the comparison will always evaluate as 'true' for the address of 'tls_array' will never be NULL [-Waddress] + 68 | if (!t->arch.tls_array) + | ^ +In file included from ../arch/x86/um/asm/processor.h:10, + from ../include/linux/rcupdate.h:30, + from ../include/linux/rculist.h:11, + from ../include/linux/pid.h:5, + from ../include/linux/sched.h:14, + from ../arch/x86/um/tls_32.c:7: +../arch/x86/um/asm/processor_32.h:22:31: note: 'tls_array' declared here + 22 | struct uml_tls_struct tls_array[GDT_ENTRY_TLS_ENTRIES]; + | ^~~~~~~~~ +../arch/x86/um/tls_32.c: In function 'get_tls_entry': +../arch/x86/um/tls_32.c:243:13: warning: the comparison will always evaluate as 'true' for the address of 'tls_array' will never be NULL [-Waddress] + 243 | if (!t->arch.tls_array) + | ^ +../arch/x86/um/asm/processor_32.h:22:31: note: 'tls_array' declared here + 22 | struct uml_tls_struct tls_array[GDT_ENTRY_TLS_ENTRIES]; + | ^~~~~~~~~ + +Signed-off-by: Lukas Straub +Acked-by: Randy Dunlap # build-tested +Signed-off-by: Richard Weinberger +Signed-off-by: Sasha Levin +--- + arch/x86/um/tls_32.c | 6 ------ + 1 file changed, 6 deletions(-) + +diff --git a/arch/x86/um/tls_32.c b/arch/x86/um/tls_32.c +index 5bd949da7a4a..b69ab2409430 100644 +--- a/arch/x86/um/tls_32.c ++++ b/arch/x86/um/tls_32.c +@@ -65,9 +65,6 @@ static int get_free_idx(struct task_struct* task) + struct thread_struct *t = &task->thread; + int idx; + +- if (!t->arch.tls_array) +- return GDT_ENTRY_TLS_MIN; +- + for (idx = 0; idx < GDT_ENTRY_TLS_ENTRIES; idx++) + if (!t->arch.tls_array[idx].present) + return idx + GDT_ENTRY_TLS_MIN; +@@ -242,9 +239,6 @@ static int get_tls_entry(struct task_struct *task, struct user_desc *info, + { + struct thread_struct *t = &task->thread; + +- if (!t->arch.tls_array) +- goto clear; +- + if (idx < GDT_ENTRY_TLS_MIN || idx > GDT_ENTRY_TLS_MAX) + return -EINVAL; + +-- +2.35.1 + diff --git a/queue-4.14/um-cleanup-syscall_handler_t-cast-in-syscalls_32.h.patch b/queue-4.14/um-cleanup-syscall_handler_t-cast-in-syscalls_32.h.patch new file mode 100644 index 00000000000..feb207a3d4d --- /dev/null +++ b/queue-4.14/um-cleanup-syscall_handler_t-cast-in-syscalls_32.h.patch @@ -0,0 +1,41 @@ +From 4b2d570cb3bb7a0f43940fafa3137e2978bebf8b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 26 Aug 2022 15:29:27 +0000 +Subject: um: Cleanup syscall_handler_t cast in syscalls_32.h + +From: Lukas Straub + +[ Upstream commit 61670b4d270c71219def1fbc9441debc2ac2e6e9 ] + +Like in f4f03f299a56ce4d73c5431e0327b3b6cb55ebb9 +"um: Cleanup syscall_handler_t definition/cast, fix warning", +remove the cast to to fix the compiler warning. + +Signed-off-by: Lukas Straub +Acked-by: Randy Dunlap # build-tested +Signed-off-by: Richard Weinberger +Signed-off-by: Sasha Levin +--- + arch/x86/um/shared/sysdep/syscalls_32.h | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + +diff --git a/arch/x86/um/shared/sysdep/syscalls_32.h b/arch/x86/um/shared/sysdep/syscalls_32.h +index 68fd2cf526fd..f6e9f84397e7 100644 +--- a/arch/x86/um/shared/sysdep/syscalls_32.h ++++ b/arch/x86/um/shared/sysdep/syscalls_32.h +@@ -6,10 +6,9 @@ + #include + #include + +-typedef long syscall_handler_t(struct pt_regs); ++typedef long syscall_handler_t(struct syscall_args); + + extern syscall_handler_t *sys_call_table[]; + + #define EXECUTE_SYSCALL(syscall, regs) \ +- ((long (*)(struct syscall_args)) \ +- (*sys_call_table[syscall]))(SYSCALL_ARGS(®s->regs)) ++ ((*sys_call_table[syscall]))(SYSCALL_ARGS(®s->regs)) +-- +2.35.1 +