From 0396058ce14e0bfe5eb5689928405bcc7531cf42 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 21 Jul 2023 16:20:59 +0200 Subject: [PATCH] 4.19-stable patches added patches: ceph-don-t-let-check_caps-skip-sending-responses-for-revoke-msgs.patch hwrng-imx-rngc-fix-the-timeout-for-init-and-self-check.patch meson-saradc-fix-clock-divider-mask-length.patch revert-8250-add-support-for-asix-devices-with-a-fifo-bug.patch tty-serial-samsung_tty-fix-a-memory-leak-in-s3c24xx_serial_getclk-in-case-of-error.patch tty-serial-samsung_tty-fix-a-memory-leak-in-s3c24xx_serial_getclk-when-iterating-clk.patch --- ...ip-sending-responses-for-revoke-msgs.patch | 47 ++++++ ...-the-timeout-for-init-and-self-check.patch | 45 ++++++ ...saradc-fix-clock-divider-mask-length.patch | 37 +++++ ...ort-for-asix-devices-with-a-fifo-bug.patch | 139 ++++++++++++++++++ queue-4.19/series | 6 + ...c24xx_serial_getclk-in-case-of-error.patch | 40 +++++ ...4xx_serial_getclk-when-iterating-clk.patch | 48 ++++++ 7 files changed, 362 insertions(+) create mode 100644 queue-4.19/ceph-don-t-let-check_caps-skip-sending-responses-for-revoke-msgs.patch create mode 100644 queue-4.19/hwrng-imx-rngc-fix-the-timeout-for-init-and-self-check.patch create mode 100644 queue-4.19/meson-saradc-fix-clock-divider-mask-length.patch create mode 100644 queue-4.19/revert-8250-add-support-for-asix-devices-with-a-fifo-bug.patch create mode 100644 queue-4.19/tty-serial-samsung_tty-fix-a-memory-leak-in-s3c24xx_serial_getclk-in-case-of-error.patch create mode 100644 queue-4.19/tty-serial-samsung_tty-fix-a-memory-leak-in-s3c24xx_serial_getclk-when-iterating-clk.patch diff --git a/queue-4.19/ceph-don-t-let-check_caps-skip-sending-responses-for-revoke-msgs.patch b/queue-4.19/ceph-don-t-let-check_caps-skip-sending-responses-for-revoke-msgs.patch new file mode 100644 index 00000000000..bdebd6ffa01 --- /dev/null +++ b/queue-4.19/ceph-don-t-let-check_caps-skip-sending-responses-for-revoke-msgs.patch @@ -0,0 +1,47 @@ +From 257e6172ab36ebbe295a6c9ee9a9dd0fe54c1dc2 Mon Sep 17 00:00:00 2001 +From: Xiubo Li +Date: Wed, 28 Jun 2023 07:57:09 +0800 +Subject: ceph: don't let check_caps skip sending responses for revoke msgs + +From: Xiubo Li + +commit 257e6172ab36ebbe295a6c9ee9a9dd0fe54c1dc2 upstream. + +If a client sends out a cap update dropping caps with the prior 'seq' +just before an incoming cap revoke request, then the client may drop +the revoke because it believes it's already released the requested +capabilities. + +This causes the MDS to wait indefinitely for the client to respond +to the revoke. It's therefore always a good idea to ack the cap +revoke request with the bumped up 'seq'. + +Cc: stable@vger.kernel.org +Link: https://tracker.ceph.com/issues/61782 +Signed-off-by: Xiubo Li +Reviewed-by: Milind Changire +Reviewed-by: Patrick Donnelly +Signed-off-by: Ilya Dryomov +Signed-off-by: Greg Kroah-Hartman +--- + fs/ceph/caps.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +--- a/fs/ceph/caps.c ++++ b/fs/ceph/caps.c +@@ -3285,6 +3285,15 @@ static void handle_cap_grant(struct inod + } + BUG_ON(cap->issued & ~cap->implemented); + ++ /* don't let check_caps skip sending a response to MDS for revoke msgs */ ++ if (le32_to_cpu(grant->op) == CEPH_CAP_OP_REVOKE) { ++ cap->mds_wanted = 0; ++ if (cap == ci->i_auth_cap) ++ check_caps = 1; /* check auth cap only */ ++ else ++ check_caps = 2; /* check all caps */ ++ } ++ + if (extra_info->inline_version > 0 && + extra_info->inline_version >= ci->i_inline_version) { + ci->i_inline_version = extra_info->inline_version; diff --git a/queue-4.19/hwrng-imx-rngc-fix-the-timeout-for-init-and-self-check.patch b/queue-4.19/hwrng-imx-rngc-fix-the-timeout-for-init-and-self-check.patch new file mode 100644 index 00000000000..4ccb0b31056 --- /dev/null +++ b/queue-4.19/hwrng-imx-rngc-fix-the-timeout-for-init-and-self-check.patch @@ -0,0 +1,45 @@ +From d744ae7477190967a3ddc289e2cd4ae59e8b1237 Mon Sep 17 00:00:00 2001 +From: Martin Kaiser +Date: Thu, 15 Jun 2023 15:49:59 +0100 +Subject: hwrng: imx-rngc - fix the timeout for init and self check + +From: Martin Kaiser + +commit d744ae7477190967a3ddc289e2cd4ae59e8b1237 upstream. + +Fix the timeout that is used for the initialisation and for the self +test. wait_for_completion_timeout expects a timeout in jiffies, but +RNGC_TIMEOUT is in milliseconds. Call msecs_to_jiffies to do the +conversion. + +Cc: stable@vger.kernel.org +Fixes: 1d5449445bd0 ("hwrng: mx-rngc - add a driver for Freescale RNGC") +Signed-off-by: Martin Kaiser +Signed-off-by: Herbert Xu +Signed-off-by: Greg Kroah-Hartman +--- + drivers/char/hw_random/imx-rngc.c | 6 ++---- + 1 file changed, 2 insertions(+), 4 deletions(-) + +--- a/drivers/char/hw_random/imx-rngc.c ++++ b/drivers/char/hw_random/imx-rngc.c +@@ -105,7 +105,7 @@ static int imx_rngc_self_test(struct imx + cmd = readl(rngc->base + RNGC_COMMAND); + writel(cmd | RNGC_CMD_SELF_TEST, rngc->base + RNGC_COMMAND); + +- ret = wait_for_completion_timeout(&rngc->rng_op_done, RNGC_TIMEOUT); ++ ret = wait_for_completion_timeout(&rngc->rng_op_done, msecs_to_jiffies(RNGC_TIMEOUT)); + if (!ret) { + imx_rngc_irq_mask_clear(rngc); + return -ETIMEDOUT; +@@ -188,9 +188,7 @@ static int imx_rngc_init(struct hwrng *r + cmd = readl(rngc->base + RNGC_COMMAND); + writel(cmd | RNGC_CMD_SEED, rngc->base + RNGC_COMMAND); + +- ret = wait_for_completion_timeout(&rngc->rng_op_done, +- RNGC_TIMEOUT); +- ++ ret = wait_for_completion_timeout(&rngc->rng_op_done, msecs_to_jiffies(RNGC_TIMEOUT)); + if (!ret) { + imx_rngc_irq_mask_clear(rngc); + return -ETIMEDOUT; diff --git a/queue-4.19/meson-saradc-fix-clock-divider-mask-length.patch b/queue-4.19/meson-saradc-fix-clock-divider-mask-length.patch new file mode 100644 index 00000000000..4d6df65e8d9 --- /dev/null +++ b/queue-4.19/meson-saradc-fix-clock-divider-mask-length.patch @@ -0,0 +1,37 @@ +From c57fa0037024c92c2ca34243e79e857da5d2c0a9 Mon Sep 17 00:00:00 2001 +From: George Stark +Date: Tue, 6 Jun 2023 19:53:57 +0300 +Subject: meson saradc: fix clock divider mask length + +From: George Stark + +commit c57fa0037024c92c2ca34243e79e857da5d2c0a9 upstream. + +According to the datasheets of supported meson SoCs length of ADC_CLK_DIV +field is 6-bit. Although all supported SoCs have the register +with that field documented later SoCs use external clock rather than +ADC internal clock so this patch affects only meson8 family (S8* SoCs). + +Fixes: 3adbf3427330 ("iio: adc: add a driver for the SAR ADC found in Amlogic Meson SoCs") +Signed-off-by: George Stark +Reviewed-by: Andy Shevchenko +Reviewed-by: Martin Blumenstingl +Link: https://lore.kernel.org/r/20230606165357.42417-1-gnstark@sberdevices.ru +Cc: +Signed-off-by: Jonathan Cameron +Signed-off-by: Greg Kroah-Hartman +--- + drivers/iio/adc/meson_saradc.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/iio/adc/meson_saradc.c ++++ b/drivers/iio/adc/meson_saradc.c +@@ -75,7 +75,7 @@ + #define MESON_SAR_ADC_REG3_PANEL_DETECT_COUNT_MASK GENMASK(20, 18) + #define MESON_SAR_ADC_REG3_PANEL_DETECT_FILTER_TB_MASK GENMASK(17, 16) + #define MESON_SAR_ADC_REG3_ADC_CLK_DIV_SHIFT 10 +- #define MESON_SAR_ADC_REG3_ADC_CLK_DIV_WIDTH 5 ++ #define MESON_SAR_ADC_REG3_ADC_CLK_DIV_WIDTH 6 + #define MESON_SAR_ADC_REG3_BLOCK_DLY_SEL_MASK GENMASK(9, 8) + #define MESON_SAR_ADC_REG3_BLOCK_DLY_MASK GENMASK(7, 0) + diff --git a/queue-4.19/revert-8250-add-support-for-asix-devices-with-a-fifo-bug.patch b/queue-4.19/revert-8250-add-support-for-asix-devices-with-a-fifo-bug.patch new file mode 100644 index 00000000000..26cabe77651 --- /dev/null +++ b/queue-4.19/revert-8250-add-support-for-asix-devices-with-a-fifo-bug.patch @@ -0,0 +1,139 @@ +From a82d62f708545d22859584e0e0620da8e3759bbc Mon Sep 17 00:00:00 2001 +From: Jiaqing Zhao +Date: Mon, 19 Jun 2023 15:57:44 +0000 +Subject: Revert "8250: add support for ASIX devices with a FIFO bug" + +From: Jiaqing Zhao + +commit a82d62f708545d22859584e0e0620da8e3759bbc upstream. + +This reverts commit eb26dfe8aa7eeb5a5aa0b7574550125f8aa4c3b3. + +Commit eb26dfe8aa7e ("8250: add support for ASIX devices with a FIFO +bug") merged on Jul 13, 2012 adds a quirk for PCI_VENDOR_ID_ASIX +(0x9710). But that ID is the same as PCI_VENDOR_ID_NETMOS defined in +1f8b061050c7 ("[PATCH] Netmos parallel/serial/combo support") merged +on Mar 28, 2005. In pci_serial_quirks array, the NetMos entry always +takes precedence over the ASIX entry even since it was initially +merged, code in that commit is always unreachable. + +In my tests, adding the FIFO workaround to pci_netmos_init() makes no +difference, and the vendor driver also does not have such workaround. +Given that the code was never used for over a decade, it's safe to +revert it. + +Also, the real PCI_VENDOR_ID_ASIX should be 0x125b, which is used on +their newer AX99100 PCIe serial controllers released on 2016. The FIFO +workaround should not be intended for these newer controllers, and it +was never implemented in vendor driver. + +Fixes: eb26dfe8aa7e ("8250: add support for ASIX devices with a FIFO bug") +Cc: stable +Signed-off-by: Jiaqing Zhao +Reviewed-by: Andy Shevchenko +Link: https://lore.kernel.org/r/20230619155743.827859-1-jiaqing.zhao@linux.intel.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/tty/serial/8250/8250.h | 1 - + drivers/tty/serial/8250/8250_pci.c | 19 ------------------- + drivers/tty/serial/8250/8250_port.c | 11 +++-------- + include/linux/serial_8250.h | 1 - + 4 files changed, 3 insertions(+), 29 deletions(-) + +--- a/drivers/tty/serial/8250/8250.h ++++ b/drivers/tty/serial/8250/8250.h +@@ -85,7 +85,6 @@ struct serial8250_config { + #define UART_BUG_TXEN (1 << 1) /* UART has buggy TX IIR status */ + #define UART_BUG_NOMSR (1 << 2) /* UART has buggy MSR status bits (Au1x00) */ + #define UART_BUG_THRE (1 << 3) /* UART has buggy THRE reassertion */ +-#define UART_BUG_PARITY (1 << 4) /* UART mishandles parity if FIFO enabled */ + + + #ifdef CONFIG_SERIAL_8250_SHARE_IRQ +--- a/drivers/tty/serial/8250/8250_pci.c ++++ b/drivers/tty/serial/8250/8250_pci.c +@@ -1049,14 +1049,6 @@ static int pci_oxsemi_tornado_init(struc + return number_uarts; + } + +-static int pci_asix_setup(struct serial_private *priv, +- const struct pciserial_board *board, +- struct uart_8250_port *port, int idx) +-{ +- port->bugs |= UART_BUG_PARITY; +- return pci_default_setup(priv, board, port, idx); +-} +- + /* Quatech devices have their own extra interface features */ + + struct quatech_feature { +@@ -1683,7 +1675,6 @@ pci_wch_ch38x_setup(struct serial_privat + #define PCI_DEVICE_ID_WCH_CH355_4S 0x7173 + #define PCI_VENDOR_ID_AGESTAR 0x5372 + #define PCI_DEVICE_ID_AGESTAR_9375 0x6872 +-#define PCI_VENDOR_ID_ASIX 0x9710 + #define PCI_DEVICE_ID_BROADCOM_TRUMANAGE 0x160a + #define PCI_DEVICE_ID_AMCC_ADDIDATA_APCI7800 0x818e + +@@ -2455,16 +2446,6 @@ static struct pci_serial_quirk pci_seria + .setup = pci_wch_ch38x_setup, + }, + /* +- * ASIX devices with FIFO bug +- */ +- { +- .vendor = PCI_VENDOR_ID_ASIX, +- .device = PCI_ANY_ID, +- .subvendor = PCI_ANY_ID, +- .subdevice = PCI_ANY_ID, +- .setup = pci_asix_setup, +- }, +- /* + * Broadcom TruManage (NetXtreme) + */ + { +--- a/drivers/tty/serial/8250/8250_port.c ++++ b/drivers/tty/serial/8250/8250_port.c +@@ -2617,11 +2617,8 @@ static unsigned char serial8250_compute_ + + if (c_cflag & CSTOPB) + cval |= UART_LCR_STOP; +- if (c_cflag & PARENB) { ++ if (c_cflag & PARENB) + cval |= UART_LCR_PARITY; +- if (up->bugs & UART_BUG_PARITY) +- up->fifo_bug = true; +- } + if (!(c_cflag & PARODD)) + cval |= UART_LCR_EPAR; + #ifdef CMSPAR +@@ -2735,8 +2732,7 @@ serial8250_do_set_termios(struct uart_po + up->lcr = cval; /* Save computed LCR */ + + if (up->capabilities & UART_CAP_FIFO && port->fifosize > 1) { +- /* NOTE: If fifo_bug is not set, a user can set RX_trigger. */ +- if ((baud < 2400 && !up->dma) || up->fifo_bug) { ++ if (baud < 2400 && !up->dma) { + up->fcr &= ~UART_FCR_TRIGGER_MASK; + up->fcr |= UART_FCR_TRIGGER_1; + } +@@ -3072,8 +3068,7 @@ static int do_set_rxtrig(struct tty_port + struct uart_8250_port *up = up_to_u8250p(uport); + int rxtrig; + +- if (!(up->capabilities & UART_CAP_FIFO) || uport->fifosize <= 1 || +- up->fifo_bug) ++ if (!(up->capabilities & UART_CAP_FIFO) || uport->fifosize <= 1) + return -EINVAL; + + rxtrig = bytes_to_fcr_rxtrig(up, bytes); +--- a/include/linux/serial_8250.h ++++ b/include/linux/serial_8250.h +@@ -99,7 +99,6 @@ struct uart_8250_port { + struct list_head list; /* ports on this IRQ */ + u32 capabilities; /* port capabilities */ + unsigned short bugs; /* port bugs */ +- bool fifo_bug; /* min RX trigger if enabled */ + unsigned int tx_loadsz; /* transmit fifo load size */ + unsigned char acr; + unsigned char fcr; diff --git a/queue-4.19/series b/queue-4.19/series index 2bb2073105f..2b3809af1e1 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -173,3 +173,9 @@ misc-pci_endpoint_test-re-init-completion-for-every-test.patch md-raid0-add-discard-support-for-the-original-layout.patch fs-dlm-return-positive-pid-value-for-f_getlk.patch serial-atmel-don-t-enable-irqs-prematurely.patch +hwrng-imx-rngc-fix-the-timeout-for-init-and-self-check.patch +ceph-don-t-let-check_caps-skip-sending-responses-for-revoke-msgs.patch +meson-saradc-fix-clock-divider-mask-length.patch +revert-8250-add-support-for-asix-devices-with-a-fifo-bug.patch +tty-serial-samsung_tty-fix-a-memory-leak-in-s3c24xx_serial_getclk-in-case-of-error.patch +tty-serial-samsung_tty-fix-a-memory-leak-in-s3c24xx_serial_getclk-when-iterating-clk.patch diff --git a/queue-4.19/tty-serial-samsung_tty-fix-a-memory-leak-in-s3c24xx_serial_getclk-in-case-of-error.patch b/queue-4.19/tty-serial-samsung_tty-fix-a-memory-leak-in-s3c24xx_serial_getclk-in-case-of-error.patch new file mode 100644 index 00000000000..c25ee1b0cf2 --- /dev/null +++ b/queue-4.19/tty-serial-samsung_tty-fix-a-memory-leak-in-s3c24xx_serial_getclk-in-case-of-error.patch @@ -0,0 +1,40 @@ +From a9c09546e903f1068acfa38e1ee18bded7114b37 Mon Sep 17 00:00:00 2001 +From: Christophe JAILLET +Date: Sat, 10 Jun 2023 17:59:25 +0200 +Subject: tty: serial: samsung_tty: Fix a memory leak in s3c24xx_serial_getclk() in case of error + +From: Christophe JAILLET + +commit a9c09546e903f1068acfa38e1ee18bded7114b37 upstream. + +If clk_get_rate() fails, the clk that has just been allocated needs to be +freed. + +Cc: # v3.3+ +Reviewed-by: Krzysztof Kozlowski +Reviewed-by: Andi Shyti +Fixes: 5f5a7a5578c5 ("serial: samsung: switch to clkdev based clock lookup") +Signed-off-by: Christophe JAILLET +Reviewed-by: Jiri Slaby +Message-ID: +Signed-off-by: Greg Kroah-Hartman +--- + drivers/tty/serial/samsung.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +--- a/drivers/tty/serial/samsung.c ++++ b/drivers/tty/serial/samsung.c +@@ -1199,8 +1199,12 @@ static unsigned int s3c24xx_serial_getcl + continue; + + rate = clk_get_rate(clk); +- if (!rate) ++ if (!rate) { ++ dev_err(ourport->port.dev, ++ "Failed to get clock rate for %s.\n", clkname); ++ clk_put(clk); + continue; ++ } + + if (ourport->info->has_divslot) { + unsigned long div = rate / req_baud; diff --git a/queue-4.19/tty-serial-samsung_tty-fix-a-memory-leak-in-s3c24xx_serial_getclk-when-iterating-clk.patch b/queue-4.19/tty-serial-samsung_tty-fix-a-memory-leak-in-s3c24xx_serial_getclk-when-iterating-clk.patch new file mode 100644 index 00000000000..7c7198883ca --- /dev/null +++ b/queue-4.19/tty-serial-samsung_tty-fix-a-memory-leak-in-s3c24xx_serial_getclk-when-iterating-clk.patch @@ -0,0 +1,48 @@ +From 832e231cff476102e8204a9e7bddfe5c6154a375 Mon Sep 17 00:00:00 2001 +From: Christophe JAILLET +Date: Sat, 10 Jun 2023 17:59:26 +0200 +Subject: tty: serial: samsung_tty: Fix a memory leak in s3c24xx_serial_getclk() when iterating clk + +From: Christophe JAILLET + +commit 832e231cff476102e8204a9e7bddfe5c6154a375 upstream. + +When the best clk is searched, we iterate over all possible clk. + +If we find a better match, the previous one, if any, needs to be freed. +If a better match has already been found, we still need to free the new +one, otherwise it leaks. + +Cc: # v3.3+ +Reviewed-by: Krzysztof Kozlowski +Reviewed-by: Andi Shyti +Fixes: 5f5a7a5578c5 ("serial: samsung: switch to clkdev based clock lookup") +Signed-off-by: Christophe JAILLET +Reviewed-by: Jiri Slaby +Message-ID: +Signed-off-by: Greg Kroah-Hartman +--- + drivers/tty/serial/samsung.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +--- a/drivers/tty/serial/samsung.c ++++ b/drivers/tty/serial/samsung.c +@@ -1230,10 +1230,18 @@ static unsigned int s3c24xx_serial_getcl + calc_deviation = -calc_deviation; + + if (calc_deviation < deviation) { ++ /* ++ * If we find a better clk, release the previous one, if ++ * any. ++ */ ++ if (!IS_ERR(*best_clk)) ++ clk_put(*best_clk); + *best_clk = clk; + best_quot = quot; + *clk_num = cnt; + deviation = calc_deviation; ++ } else { ++ clk_put(clk); + } + } + -- 2.47.3