From 597b922b1f5753e0001c291a9293b59f77ecf89b Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 17 Jan 2020 00:05:04 +0100 Subject: [PATCH] 4.4-stable patches added patches: compat_ioctl-handle-siocoutqnsd.patch media-exynos4-is-fix-recursive-locking-in-isp_video_release.patch rtc-msm6242-fix-reading-of-10-hour-digit.patch rtlwifi-remove-unnecessary-null-check-in-rtl_regd_init.patch spi-atmel-fix-handling-of-cs_change-set-on-non-last-xfer.patch tty-serial-imx-use-the-sg-count-from-dma_map_sg.patch tty-serial-pch_uart-correct-usage-of-dma_unmap_sg.patch --- .../compat_ioctl-handle-siocoutqnsd.patch | 34 ++++++++++ ...cursive-locking-in-isp_video_release.patch | 36 ++++++++++ ...msm6242-fix-reading-of-10-hour-digit.patch | 40 ++++++++++++ ...ecessary-null-check-in-rtl_regd_init.patch | 51 +++++++++++++++ queue-4.4/series | 7 ++ ...ng-of-cs_change-set-on-non-last-xfer.patch | 63 ++++++++++++++++++ ...imx-use-the-sg-count-from-dma_map_sg.patch | 33 ++++++++++ ...h_uart-correct-usage-of-dma_unmap_sg.patch | 65 +++++++++++++++++++ 8 files changed, 329 insertions(+) create mode 100644 queue-4.4/compat_ioctl-handle-siocoutqnsd.patch create mode 100644 queue-4.4/media-exynos4-is-fix-recursive-locking-in-isp_video_release.patch create mode 100644 queue-4.4/rtc-msm6242-fix-reading-of-10-hour-digit.patch create mode 100644 queue-4.4/rtlwifi-remove-unnecessary-null-check-in-rtl_regd_init.patch create mode 100644 queue-4.4/spi-atmel-fix-handling-of-cs_change-set-on-non-last-xfer.patch create mode 100644 queue-4.4/tty-serial-imx-use-the-sg-count-from-dma_map_sg.patch create mode 100644 queue-4.4/tty-serial-pch_uart-correct-usage-of-dma_unmap_sg.patch diff --git a/queue-4.4/compat_ioctl-handle-siocoutqnsd.patch b/queue-4.4/compat_ioctl-handle-siocoutqnsd.patch new file mode 100644 index 00000000000..6af29fd43e5 --- /dev/null +++ b/queue-4.4/compat_ioctl-handle-siocoutqnsd.patch @@ -0,0 +1,34 @@ +From 9d7bf41fafa5b5ddd4c13eb39446b0045f0a8167 Mon Sep 17 00:00:00 2001 +From: Arnd Bergmann +Date: Mon, 3 Jun 2019 23:06:00 +0200 +Subject: compat_ioctl: handle SIOCOUTQNSD + +From: Arnd Bergmann + +commit 9d7bf41fafa5b5ddd4c13eb39446b0045f0a8167 upstream. + +Unlike the normal SIOCOUTQ, SIOCOUTQNSD was never handled in compat +mode. Add it to the common socket compat handler along with similar +ones. + +Fixes: 2f4e1b397097 ("tcp: ioctl type SIOCOUTQNSD returns amount of data not sent") +Cc: Eric Dumazet +Cc: netdev@vger.kernel.org +Cc: "David S. Miller" +Signed-off-by: Arnd Bergmann +Signed-off-by: Greg Kroah-Hartman + +--- + net/socket.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/net/socket.c ++++ b/net/socket.c +@@ -3143,6 +3143,7 @@ static int compat_sock_ioctl_trans(struc + case SIOCSARP: + case SIOCGARP: + case SIOCDARP: ++ case SIOCOUTQNSD: + case SIOCATMARK: + return sock_do_ioctl(net, sock, cmd, arg); + } diff --git a/queue-4.4/media-exynos4-is-fix-recursive-locking-in-isp_video_release.patch b/queue-4.4/media-exynos4-is-fix-recursive-locking-in-isp_video_release.patch new file mode 100644 index 00000000000..c7787f2b4c1 --- /dev/null +++ b/queue-4.4/media-exynos4-is-fix-recursive-locking-in-isp_video_release.patch @@ -0,0 +1,36 @@ +From 704c6c80fb471d1bb0ef0d61a94617d1d55743cd Mon Sep 17 00:00:00 2001 +From: Seung-Woo Kim +Date: Fri, 18 Oct 2019 07:20:52 -0300 +Subject: media: exynos4-is: Fix recursive locking in isp_video_release() + +From: Seung-Woo Kim + +commit 704c6c80fb471d1bb0ef0d61a94617d1d55743cd upstream. + +>From isp_video_release(), &isp->video_lock is held and subsequent +vb2_fop_release() tries to lock vdev->lock which is same with the +previous one. Replace vb2_fop_release() with _vb2_fop_release() to +fix the recursive locking. + +Fixes: 1380f5754cb0 ("[media] videobuf2: Add missing lock held on vb2_fop_release") +Signed-off-by: Seung-Woo Kim +Reviewed-by: Sylwester Nawrocki +Signed-off-by: Hans Verkuil +Signed-off-by: Mauro Carvalho Chehab +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/media/platform/exynos4-is/fimc-isp-video.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/media/platform/exynos4-is/fimc-isp-video.c ++++ b/drivers/media/platform/exynos4-is/fimc-isp-video.c +@@ -323,7 +323,7 @@ static int isp_video_release(struct file + ivc->streaming = 0; + } + +- vb2_fop_release(file); ++ _vb2_fop_release(file, NULL); + + if (v4l2_fh_is_singular_file(file)) { + fimc_pipeline_call(&ivc->ve, close); diff --git a/queue-4.4/rtc-msm6242-fix-reading-of-10-hour-digit.patch b/queue-4.4/rtc-msm6242-fix-reading-of-10-hour-digit.patch new file mode 100644 index 00000000000..307c5f95cf5 --- /dev/null +++ b/queue-4.4/rtc-msm6242-fix-reading-of-10-hour-digit.patch @@ -0,0 +1,40 @@ +From e34494c8df0cd96fc432efae121db3212c46ae48 Mon Sep 17 00:00:00 2001 +From: Kars de Jong +Date: Sat, 16 Nov 2019 12:05:48 +0100 +Subject: rtc: msm6242: Fix reading of 10-hour digit + +From: Kars de Jong + +commit e34494c8df0cd96fc432efae121db3212c46ae48 upstream. + +The driver was reading the wrong register as the 10-hour digit due to +a misplaced ')'. It was in fact reading the 1-second digit register due +to this bug. + +Also remove the use of a magic number for the hour mask and use the define +for it which was already present. + +Fixes: 4f9b9bba1dd1 ("rtc: Add an RTC driver for the Oki MSM6242") +Tested-by: Kars de Jong +Signed-off-by: Kars de Jong +Link: https://lore.kernel.org/r/20191116110548.8562-1-jongk@linux-m68k.org +Reviewed-by: Geert Uytterhoeven +Signed-off-by: Alexandre Belloni +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/rtc/rtc-msm6242.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/drivers/rtc/rtc-msm6242.c ++++ b/drivers/rtc/rtc-msm6242.c +@@ -132,7 +132,8 @@ static int msm6242_read_time(struct devi + msm6242_read(priv, MSM6242_SECOND1); + tm->tm_min = msm6242_read(priv, MSM6242_MINUTE10) * 10 + + msm6242_read(priv, MSM6242_MINUTE1); +- tm->tm_hour = (msm6242_read(priv, MSM6242_HOUR10 & 3)) * 10 + ++ tm->tm_hour = (msm6242_read(priv, MSM6242_HOUR10) & ++ MSM6242_HOUR10_HR_MASK) * 10 + + msm6242_read(priv, MSM6242_HOUR1); + tm->tm_mday = msm6242_read(priv, MSM6242_DAY10) * 10 + + msm6242_read(priv, MSM6242_DAY1); diff --git a/queue-4.4/rtlwifi-remove-unnecessary-null-check-in-rtl_regd_init.patch b/queue-4.4/rtlwifi-remove-unnecessary-null-check-in-rtl_regd_init.patch new file mode 100644 index 00000000000..d34c6c76cdd --- /dev/null +++ b/queue-4.4/rtlwifi-remove-unnecessary-null-check-in-rtl_regd_init.patch @@ -0,0 +1,51 @@ +From 091c6e9c083f7ebaff00b37ad13562d51464d175 Mon Sep 17 00:00:00 2001 +From: Nathan Chancellor +Date: Tue, 22 Oct 2019 17:47:03 -0700 +Subject: rtlwifi: Remove unnecessary NULL check in rtl_regd_init + +From: Nathan Chancellor + +commit 091c6e9c083f7ebaff00b37ad13562d51464d175 upstream. + +When building with Clang + -Wtautological-pointer-compare: + +drivers/net/wireless/realtek/rtlwifi/regd.c:389:33: warning: comparison +of address of 'rtlpriv->regd' equal to a null pointer is always false +[-Wtautological-pointer-compare] + if (wiphy == NULL || &rtlpriv->regd == NULL) + ~~~~~~~~~^~~~ ~~~~ +1 warning generated. + +The address of an array member is never NULL unless it is the first +struct member so remove the unnecessary check. This was addressed in +the staging version of the driver in commit f986978b32b3 ("Staging: +rtlwifi: remove unnecessary NULL check"). + +While we are here, fix the following checkpatch warning: + +CHECK: Comparison to NULL could be written "!wiphy" +35: FILE: drivers/net/wireless/realtek/rtlwifi/regd.c:389: ++ if (wiphy == NULL) + +Fixes: 0c8173385e54 ("rtl8192ce: Add new driver") +Link:https://github.com/ClangBuiltLinux/linux/issues/750 +Signed-off-by: Nathan Chancellor +Acked-by: Ping-Ke Shih +Signed-off-by: Kalle Valo +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/net/wireless/realtek/rtlwifi/regd.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/wireless/realtek/rtlwifi/regd.c ++++ b/drivers/net/wireless/realtek/rtlwifi/regd.c +@@ -427,7 +427,7 @@ int rtl_regd_init(struct ieee80211_hw *h + struct wiphy *wiphy = hw->wiphy; + struct country_code_to_enum_rd *country = NULL; + +- if (wiphy == NULL || &rtlpriv->regd == NULL) ++ if (!wiphy) + return -EINVAL; + + /* init country_code from efuse channel plan */ diff --git a/queue-4.4/series b/queue-4.4/series index 95313169cae..fd38ce33d76 100644 --- a/queue-4.4/series +++ b/queue-4.4/series @@ -27,3 +27,10 @@ platform-x86-asus-wmi-fix-keyboard-brightness-cannot-be-set-to-0.patch iio-imu-adis16480-assign-bias-value-only-if-operation-succeeded.patch mei-fix-modalias-documentation.patch clk-samsung-exynos5420-preserve-cpu-clocks-configuration-during-suspend-resume.patch +compat_ioctl-handle-siocoutqnsd.patch +tty-serial-imx-use-the-sg-count-from-dma_map_sg.patch +tty-serial-pch_uart-correct-usage-of-dma_unmap_sg.patch +media-exynos4-is-fix-recursive-locking-in-isp_video_release.patch +spi-atmel-fix-handling-of-cs_change-set-on-non-last-xfer.patch +rtlwifi-remove-unnecessary-null-check-in-rtl_regd_init.patch +rtc-msm6242-fix-reading-of-10-hour-digit.patch diff --git a/queue-4.4/spi-atmel-fix-handling-of-cs_change-set-on-non-last-xfer.patch b/queue-4.4/spi-atmel-fix-handling-of-cs_change-set-on-non-last-xfer.patch new file mode 100644 index 00000000000..8f921a3644c --- /dev/null +++ b/queue-4.4/spi-atmel-fix-handling-of-cs_change-set-on-non-last-xfer.patch @@ -0,0 +1,63 @@ +From fed8d8c7a6dc2a76d7764842853d81c770b0788e Mon Sep 17 00:00:00 2001 +From: Mans Rullgard +Date: Fri, 18 Oct 2019 17:35:04 +0200 +Subject: spi: atmel: fix handling of cs_change set on non-last xfer + +From: Mans Rullgard + +commit fed8d8c7a6dc2a76d7764842853d81c770b0788e upstream. + +The driver does the wrong thing when cs_change is set on a non-last +xfer in a message. When cs_change is set, the driver deactivates the +CS and leaves it off until a later xfer again has cs_change set whereas +it should be briefly toggling CS off and on again. + +This patch brings the behaviour of the driver back in line with the +documentation and common sense. The delay of 10 us is the same as is +used by the default spi_transfer_one_message() function in spi.c. +[gregory: rebased on for-5.5 from spi tree] +Fixes: 8090d6d1a415 ("spi: atmel: Refactor spi-atmel to use SPI framework queue") +Signed-off-by: Mans Rullgard +Acked-by: Nicolas Ferre +Signed-off-by: Gregory CLEMENT +Link: https://lore.kernel.org/r/20191018153504.4249-1-gregory.clement@bootlin.com +Signed-off-by: Mark Brown +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/spi/spi-atmel.c | 10 +++------- + 1 file changed, 3 insertions(+), 7 deletions(-) + +--- a/drivers/spi/spi-atmel.c ++++ b/drivers/spi/spi-atmel.c +@@ -315,7 +315,6 @@ struct atmel_spi { + struct atmel_spi_dma dma; + + bool keep_cs; +- bool cs_active; + + u32 fifo_size; + }; +@@ -1404,11 +1403,9 @@ static int atmel_spi_one_transfer(struct + &msg->transfers)) { + as->keep_cs = true; + } else { +- as->cs_active = !as->cs_active; +- if (as->cs_active) +- cs_activate(as, msg->spi); +- else +- cs_deactivate(as, msg->spi); ++ cs_deactivate(as, msg->spi); ++ udelay(10); ++ cs_activate(as, msg->spi); + } + } + +@@ -1431,7 +1428,6 @@ static int atmel_spi_transfer_one_messag + atmel_spi_lock(as); + cs_activate(as, spi); + +- as->cs_active = true; + as->keep_cs = false; + + msg->status = 0; diff --git a/queue-4.4/tty-serial-imx-use-the-sg-count-from-dma_map_sg.patch b/queue-4.4/tty-serial-imx-use-the-sg-count-from-dma_map_sg.patch new file mode 100644 index 00000000000..d7fe6f39742 --- /dev/null +++ b/queue-4.4/tty-serial-imx-use-the-sg-count-from-dma_map_sg.patch @@ -0,0 +1,33 @@ +From 596fd8dffb745afcebc0ec6968e17fe29f02044c Mon Sep 17 00:00:00 2001 +From: Peng Fan +Date: Thu, 7 Nov 2019 06:42:53 +0000 +Subject: tty: serial: imx: use the sg count from dma_map_sg + +From: Peng Fan + +commit 596fd8dffb745afcebc0ec6968e17fe29f02044c upstream. + +The dmaengine_prep_slave_sg needs to use sg count returned +by dma_map_sg, not use sport->dma_tx_nents, because the return +value of dma_map_sg is not always same with "nents". + +Fixes: b4cdc8f61beb ("serial: imx: add DMA support for imx6q") +Signed-off-by: Peng Fan +Link: https://lore.kernel.org/r/1573108875-26530-1-git-send-email-peng.fan@nxp.com +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/tty/serial/imx.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/tty/serial/imx.c ++++ b/drivers/tty/serial/imx.c +@@ -545,7 +545,7 @@ static void imx_dma_tx(struct imx_port * + dev_err(dev, "DMA mapping error for TX.\n"); + return; + } +- desc = dmaengine_prep_slave_sg(chan, sgl, sport->dma_tx_nents, ++ desc = dmaengine_prep_slave_sg(chan, sgl, ret, + DMA_MEM_TO_DEV, DMA_PREP_INTERRUPT); + if (!desc) { + dma_unmap_sg(dev, sgl, sport->dma_tx_nents, diff --git a/queue-4.4/tty-serial-pch_uart-correct-usage-of-dma_unmap_sg.patch b/queue-4.4/tty-serial-pch_uart-correct-usage-of-dma_unmap_sg.patch new file mode 100644 index 00000000000..3e70fdbaffd --- /dev/null +++ b/queue-4.4/tty-serial-pch_uart-correct-usage-of-dma_unmap_sg.patch @@ -0,0 +1,65 @@ +From 74887542fdcc92ad06a48c0cca17cdf09fc8aa00 Mon Sep 17 00:00:00 2001 +From: Peng Fan +Date: Wed, 13 Nov 2019 05:37:42 +0000 +Subject: tty: serial: pch_uart: correct usage of dma_unmap_sg + +From: Peng Fan + +commit 74887542fdcc92ad06a48c0cca17cdf09fc8aa00 upstream. + +Per Documentation/DMA-API-HOWTO.txt, +To unmap a scatterlist, just call: + dma_unmap_sg(dev, sglist, nents, direction); + +.. note:: + + The 'nents' argument to the dma_unmap_sg call must be + the _same_ one you passed into the dma_map_sg call, + it should _NOT_ be the 'count' value _returned_ from the + dma_map_sg call. + +However in the driver, priv->nent is directly assigned with value +returned from dma_map_sg, and dma_unmap_sg use priv->nent for unmap, +this breaks the API usage. + +So introduce a new entry orig_nent to remember 'nents'. + +Fixes: da3564ee027e ("pch_uart: add multi-scatter processing") +Signed-off-by: Peng Fan +Link: https://lore.kernel.org/r/1573623259-6339-1-git-send-email-peng.fan@nxp.com +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/tty/serial/pch_uart.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +--- a/drivers/tty/serial/pch_uart.c ++++ b/drivers/tty/serial/pch_uart.c +@@ -251,6 +251,7 @@ struct eg20t_port { + struct dma_chan *chan_rx; + struct scatterlist *sg_tx_p; + int nent; ++ int orig_nent; + struct scatterlist sg_rx; + int tx_dma_use; + void *rx_buf_virt; +@@ -804,9 +805,10 @@ static void pch_dma_tx_complete(void *ar + } + xmit->tail &= UART_XMIT_SIZE - 1; + async_tx_ack(priv->desc_tx); +- dma_unmap_sg(port->dev, sg, priv->nent, DMA_TO_DEVICE); ++ dma_unmap_sg(port->dev, sg, priv->orig_nent, DMA_TO_DEVICE); + priv->tx_dma_use = 0; + priv->nent = 0; ++ priv->orig_nent = 0; + kfree(priv->sg_tx_p); + pch_uart_hal_enable_interrupt(priv, PCH_UART_HAL_TX_INT); + } +@@ -1031,6 +1033,7 @@ static unsigned int dma_handle_tx(struct + dev_err(priv->port.dev, "%s:dma_map_sg Failed\n", __func__); + return 0; + } ++ priv->orig_nent = num; + priv->nent = nent; + + for (i = 0; i < nent; i++, sg++) { -- 2.47.3