--- /dev/null
+From 49221cf86d18bb66fe95d3338cb33bd4b9880ca5 Mon Sep 17 00:00:00 2001
+From: Miklos Szeredi <mszeredi@redhat.com>
+Date: Tue, 22 Jun 2021 09:15:35 +0200
+Subject: fuse: reject internal errno
+
+From: Miklos Szeredi <mszeredi@redhat.com>
+
+commit 49221cf86d18bb66fe95d3338cb33bd4b9880ca5 upstream.
+
+Don't allow userspace to report errors that could be kernel-internal.
+
+Reported-by: Anatoly Trosinenko <anatoly.trosinenko@gmail.com>
+Fixes: 334f485df85a ("[PATCH] FUSE - device functions")
+Cc: <stable@vger.kernel.org> # v2.6.14
+Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ 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);
--- /dev/null
+From 0e4cf69ede8751d25f733cd7a6f954c5b505fa03 Mon Sep 17 00:00:00 2001
+From: Miquel Raynal <miquel.raynal@bootlin.com>
+Date: Fri, 23 Nov 2018 16:45:29 +0100
+Subject: serial: mvebu-uart: clarify the baud rate derivation
+
+From: Miquel Raynal <miquel.raynal@bootlin.com>
+
+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 <miquel.raynal@bootlin.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ 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;
--- /dev/null
+From 9078204ca5c33ba20443a8623a41a68a9995a70d Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <pali@kernel.org>
+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 <pali@kernel.org>
+
+commit 9078204ca5c33ba20443a8623a41a68a9995a70d upstream.
+
+The clock divisor should be rounded to the closest value.
+
+Signed-off-by: Pali Rohár <pali@kernel.org>
+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 <gregkh@linuxfoundation.org>
+
+---
+ 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;