From: Greg Kroah-Hartman Date: Thu, 15 Jul 2021 11:52:38 +0000 (+0200) Subject: 4.19-stable patches X-Git-Tag: v5.4.133~53 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=76dae10d5616e87e0d61e3b3a7f4a3dc2b57a87d;p=thirdparty%2Fkernel%2Fstable-queue.git 4.19-stable patches added patches: fuse-reject-internal-errno.patch serial-mvebu-uart-clarify-the-baud-rate-derivation.patch serial-mvebu-uart-fix-calculation-of-clock-divisor.patch --- diff --git a/queue-4.19/fuse-reject-internal-errno.patch b/queue-4.19/fuse-reject-internal-errno.patch new file mode 100644 index 00000000000..fb57ef76155 --- /dev/null +++ b/queue-4.19/fuse-reject-internal-errno.patch @@ -0,0 +1,32 @@ +From 49221cf86d18bb66fe95d3338cb33bd4b9880ca5 Mon Sep 17 00:00:00 2001 +From: Miklos Szeredi +Date: Tue, 22 Jun 2021 09:15:35 +0200 +Subject: fuse: reject internal errno + +From: Miklos Szeredi + +commit 49221cf86d18bb66fe95d3338cb33bd4b9880ca5 upstream. + +Don't allow userspace to report errors that could be kernel-internal. + +Reported-by: Anatoly Trosinenko +Fixes: 334f485df85a ("[PATCH] FUSE - device functions") +Cc: # v2.6.14 +Signed-off-by: Miklos Szeredi +Signed-off-by: Greg Kroah-Hartman + +--- + fs/fuse/dev.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/fs/fuse/dev.c ++++ b/fs/fuse/dev.c +@@ -1896,7 +1896,7 @@ static ssize_t fuse_dev_do_write(struct + } + + err = -EINVAL; +- if (oh.error <= -1000 || oh.error > 0) ++ if (oh.error <= -512 || oh.error > 0) + goto err_finish; + + spin_lock(&fpq->lock); diff --git a/queue-4.19/serial-mvebu-uart-clarify-the-baud-rate-derivation.patch b/queue-4.19/serial-mvebu-uart-clarify-the-baud-rate-derivation.patch new file mode 100644 index 00000000000..74f71d9bfc7 --- /dev/null +++ b/queue-4.19/serial-mvebu-uart-clarify-the-baud-rate-derivation.patch @@ -0,0 +1,69 @@ +From 0e4cf69ede8751d25f733cd7a6f954c5b505fa03 Mon Sep 17 00:00:00 2001 +From: Miquel Raynal +Date: Fri, 23 Nov 2018 16:45:29 +0100 +Subject: serial: mvebu-uart: clarify the baud rate derivation + +From: Miquel Raynal + +commit 0e4cf69ede8751d25f733cd7a6f954c5b505fa03 upstream. + +The current comment in ->set_baud_rate() is rather incomplete as it +fails to describe what are the actual stages for the baudrate +derivation. Replace this comment with something more explicit and +close to the functional specification. Also adapt the variable names +to it. + +Signed-off-by: Miquel Raynal +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/tty/serial/mvebu-uart.c | 22 ++++++++++++++-------- + 1 file changed, 14 insertions(+), 8 deletions(-) + +--- a/drivers/tty/serial/mvebu-uart.c ++++ b/drivers/tty/serial/mvebu-uart.c +@@ -72,6 +72,7 @@ + #define BRDV_BAUD_MASK 0x3FF + + #define UART_OSAMP 0x14 ++#define OSAMP_DEFAULT_DIVISOR 16 + + #define MVEBU_NR_UARTS 2 + +@@ -444,23 +445,28 @@ static void mvebu_uart_shutdown(struct u + static int mvebu_uart_baud_rate_set(struct uart_port *port, unsigned int baud) + { + struct mvebu_uart *mvuart = to_mvuart(port); +- unsigned int baud_rate_div; ++ unsigned int d_divisor, m_divisor; + u32 brdv; + + if (IS_ERR(mvuart->clk)) + return -PTR_ERR(mvuart->clk); + + /* +- * The UART clock is divided by the value of the divisor to generate +- * UCLK_OUT clock, which is 16 times faster than the baudrate. +- * This prescaler can achieve all standard baudrates until 230400. +- * Higher baudrates could be achieved for the extended UART by using the +- * programmable oversampling stack (also called fractional divisor). ++ * The baudrate is derived from the UART clock thanks to two divisors: ++ * > D ("baud generator"): can divide the clock from 2 to 2^10 - 1. ++ * > M ("fractional divisor"): allows a better accuracy for ++ * baudrates higher than 230400. ++ * ++ * As the derivation of M is rather complicated, the code sticks to its ++ * default value (x16) when all the prescalers are zeroed, and only ++ * makes use of D to configure the desired baudrate. + */ +- baud_rate_div = DIV_ROUND_UP(port->uartclk, baud * 16); ++ m_divisor = OSAMP_DEFAULT_DIVISOR; ++ d_divisor = DIV_ROUND_UP(port->uartclk, baud * m_divisor); ++ + brdv = readl(port->membase + UART_BRDV); + brdv &= ~BRDV_BAUD_MASK; +- brdv |= baud_rate_div; ++ brdv |= d_divisor; + writel(brdv, port->membase + UART_BRDV); + + return 0; diff --git a/queue-4.19/serial-mvebu-uart-fix-calculation-of-clock-divisor.patch b/queue-4.19/serial-mvebu-uart-fix-calculation-of-clock-divisor.patch new file mode 100644 index 00000000000..0cf9f9c2a73 --- /dev/null +++ b/queue-4.19/serial-mvebu-uart-fix-calculation-of-clock-divisor.patch @@ -0,0 +1,35 @@ +From 9078204ca5c33ba20443a8623a41a68a9995a70d Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Pali=20Roh=C3=A1r?= +Date: Fri, 25 Jun 2021 00:49:00 +0200 +Subject: serial: mvebu-uart: fix calculation of clock divisor +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Pali Rohár + +commit 9078204ca5c33ba20443a8623a41a68a9995a70d upstream. + +The clock divisor should be rounded to the closest value. + +Signed-off-by: Pali Rohár +Fixes: 68a0db1d7da2 ("serial: mvebu-uart: add function to change baudrate") +Cc: stable@vger.kernel.org # 0e4cf69ede87 ("serial: mvebu-uart: clarify the baud rate derivation") +Link: https://lore.kernel.org/r/20210624224909.6350-2-pali@kernel.org +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/tty/serial/mvebu-uart.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/tty/serial/mvebu-uart.c ++++ b/drivers/tty/serial/mvebu-uart.c +@@ -462,7 +462,7 @@ static int mvebu_uart_baud_rate_set(stru + * makes use of D to configure the desired baudrate. + */ + m_divisor = OSAMP_DEFAULT_DIVISOR; +- d_divisor = DIV_ROUND_UP(port->uartclk, baud * m_divisor); ++ d_divisor = DIV_ROUND_CLOSEST(port->uartclk, baud * m_divisor); + + brdv = readl(port->membase + UART_BRDV); + brdv &= ~BRDV_BAUD_MASK; diff --git a/queue-4.19/series b/queue-4.19/series index 85899312954..e09b17f0c30 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -279,3 +279,6 @@ sctp-add-size-validation-when-walking-chunks.patch mips-set-mips32r5-for-virt-extensions.patch fscrypt-don-t-ignore-minor_hash-when-hash-is-0.patch bdi-do-not-use-freezable-workqueue.patch +serial-mvebu-uart-clarify-the-baud-rate-derivation.patch +serial-mvebu-uart-fix-calculation-of-clock-divisor.patch +fuse-reject-internal-errno.patch