linux-next: build failure after merge of the tty tree

Message ID 20230123131818.2785f4e8@canb.auug.org.au
State New
Headers
Series linux-next: build failure after merge of the tty tree |

Commit Message

Stephen Rothwell Jan. 23, 2023, 2:18 a.m. UTC
  Hi all,

After merging the tty tree, today's linux-next build (x86_64 allmodconfig)
failed like this:

drivers/tty/serial/qcom_geni_serial.c: In function 'setup_fifos':
drivers/tty/serial/qcom_geni_serial.c:1058:17: error: 'struct qcom_geni_serial_port' has no member named 'rx_fifo'
 1058 |         if (port->rx_fifo && (old_rx_fifo_depth != port->rx_fifo_depth) && port->rx_fifo_depth) {
      |                 ^~
drivers/tty/serial/qcom_geni_serial.c:1059:21: error: 'struct qcom_geni_serial_port' has no member named 'rx_fifo'
 1059 |                 port->rx_fifo = devm_krealloc(uport->dev, port->rx_fifo,
      |                     ^~
drivers/tty/serial/qcom_geni_serial.c:1059:63: error: 'struct qcom_geni_serial_port' has no member named 'rx_fifo'
 1059 |                 port->rx_fifo = devm_krealloc(uport->dev, port->rx_fifo,
      |                                                               ^~
drivers/tty/serial/qcom_geni_serial.c:1062:26: error: 'struct qcom_geni_serial_port' has no member named 'rx_fifo'
 1062 |                 if (!port->rx_fifo)
      |                          ^~

Caused by commit

  2aaa43c70778 ("tty: serial: qcom-geni-serial: add support for serial engine DMA")

interacting with commit

  b8caf69a6946 ("tty: serial: qcom-geni-serial: fix slab-out-of-bounds on RX FIFO buffer")

from Linus' tree.

I have applied the following merge fix patch for today (I am not sure
if it is actually correct, but it builds).

From: Stephen Rothwell <sfr@canb.auug.org.au>
Date: Mon, 23 Jan 2023 13:09:27 +1100
Subject: [PATCH] tty: fix up for "tty: serial: qcom-geni-serial: add support
 for serial engine DMA"

interacting with "tty: serial: qcom-geni-serial: fix slab-out-of-bounds
on RX FIFO buffer".

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 drivers/tty/serial/qcom_geni_serial.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
  

Comments

Bartosz Golaszewski Jan. 23, 2023, 9:46 a.m. UTC | #1
On Mon, 23 Jan 2023 at 03:18, Stephen Rothwell <sfr@canb.auug.org.au> wrote:
>
> Hi all,
>
> After merging the tty tree, today's linux-next build (x86_64 allmodconfig)
> failed like this:
>
> drivers/tty/serial/qcom_geni_serial.c: In function 'setup_fifos':
> drivers/tty/serial/qcom_geni_serial.c:1058:17: error: 'struct qcom_geni_serial_port' has no member named 'rx_fifo'
>  1058 |         if (port->rx_fifo && (old_rx_fifo_depth != port->rx_fifo_depth) && port->rx_fifo_depth) {
>       |                 ^~
> drivers/tty/serial/qcom_geni_serial.c:1059:21: error: 'struct qcom_geni_serial_port' has no member named 'rx_fifo'
>  1059 |                 port->rx_fifo = devm_krealloc(uport->dev, port->rx_fifo,
>       |                     ^~
> drivers/tty/serial/qcom_geni_serial.c:1059:63: error: 'struct qcom_geni_serial_port' has no member named 'rx_fifo'
>  1059 |                 port->rx_fifo = devm_krealloc(uport->dev, port->rx_fifo,
>       |                                                               ^~
> drivers/tty/serial/qcom_geni_serial.c:1062:26: error: 'struct qcom_geni_serial_port' has no member named 'rx_fifo'
>  1062 |                 if (!port->rx_fifo)
>       |                          ^~
>
> Caused by commit
>
>   2aaa43c70778 ("tty: serial: qcom-geni-serial: add support for serial engine DMA")
>
> interacting with commit
>
>   b8caf69a6946 ("tty: serial: qcom-geni-serial: fix slab-out-of-bounds on RX FIFO buffer")
>
> from Linus' tree.
>
> I have applied the following merge fix patch for today (I am not sure
> if it is actually correct, but it builds).
>
> From: Stephen Rothwell <sfr@canb.auug.org.au>
> Date: Mon, 23 Jan 2023 13:09:27 +1100
> Subject: [PATCH] tty: fix up for "tty: serial: qcom-geni-serial: add support
>  for serial engine DMA"
>
> interacting with "tty: serial: qcom-geni-serial: fix slab-out-of-bounds
> on RX FIFO buffer".
>
> Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
> ---
>  drivers/tty/serial/qcom_geni_serial.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c
> index d98e0a8aae7c..61350007bf1c 100644
> --- a/drivers/tty/serial/qcom_geni_serial.c
> +++ b/drivers/tty/serial/qcom_geni_serial.c
> @@ -1055,11 +1055,11 @@ static int setup_fifos(struct qcom_geni_serial_port *port)
>         uport->fifosize =
>                 (port->tx_fifo_depth * port->tx_fifo_width) / BITS_PER_BYTE;
>
> -       if (port->rx_fifo && (old_rx_fifo_depth != port->rx_fifo_depth) && port->rx_fifo_depth) {
> -               port->rx_fifo = devm_krealloc(uport->dev, port->rx_fifo,
> +       if (port->rx_buf && (old_rx_fifo_depth != port->rx_fifo_depth) && port->rx_fifo_depth) {
> +               port->rx_buf = devm_krealloc(uport->dev, port->rx_buf,
>                                               port->rx_fifo_depth * sizeof(u32),
>                                               GFP_KERNEL);
> -               if (!port->rx_fifo)
> +               if (!port->rx_buf)
>                         return -ENOMEM;
>         }
>
> --
> 2.35.1
>
> --
> Cheers,
> Stephen Rothwell

This looks fine and works fine:

Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Tested-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
  
Greg KH Jan. 23, 2023, 5:52 p.m. UTC | #2
On Mon, Jan 23, 2023 at 10:46:28AM +0100, Bartosz Golaszewski wrote:
> On Mon, 23 Jan 2023 at 03:18, Stephen Rothwell <sfr@canb.auug.org.au> wrote:
> >
> > Hi all,
> >
> > After merging the tty tree, today's linux-next build (x86_64 allmodconfig)
> > failed like this:
> >
> > drivers/tty/serial/qcom_geni_serial.c: In function 'setup_fifos':
> > drivers/tty/serial/qcom_geni_serial.c:1058:17: error: 'struct qcom_geni_serial_port' has no member named 'rx_fifo'
> >  1058 |         if (port->rx_fifo && (old_rx_fifo_depth != port->rx_fifo_depth) && port->rx_fifo_depth) {
> >       |                 ^~
> > drivers/tty/serial/qcom_geni_serial.c:1059:21: error: 'struct qcom_geni_serial_port' has no member named 'rx_fifo'
> >  1059 |                 port->rx_fifo = devm_krealloc(uport->dev, port->rx_fifo,
> >       |                     ^~
> > drivers/tty/serial/qcom_geni_serial.c:1059:63: error: 'struct qcom_geni_serial_port' has no member named 'rx_fifo'
> >  1059 |                 port->rx_fifo = devm_krealloc(uport->dev, port->rx_fifo,
> >       |                                                               ^~
> > drivers/tty/serial/qcom_geni_serial.c:1062:26: error: 'struct qcom_geni_serial_port' has no member named 'rx_fifo'
> >  1062 |                 if (!port->rx_fifo)
> >       |                          ^~
> >
> > Caused by commit
> >
> >   2aaa43c70778 ("tty: serial: qcom-geni-serial: add support for serial engine DMA")
> >
> > interacting with commit
> >
> >   b8caf69a6946 ("tty: serial: qcom-geni-serial: fix slab-out-of-bounds on RX FIFO buffer")
> >
> > from Linus' tree.
> >
> > I have applied the following merge fix patch for today (I am not sure
> > if it is actually correct, but it builds).
> >
> > From: Stephen Rothwell <sfr@canb.auug.org.au>
> > Date: Mon, 23 Jan 2023 13:09:27 +1100
> > Subject: [PATCH] tty: fix up for "tty: serial: qcom-geni-serial: add support
> >  for serial engine DMA"
> >
> > interacting with "tty: serial: qcom-geni-serial: fix slab-out-of-bounds
> > on RX FIFO buffer".
> >
> > Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
> > ---
> >  drivers/tty/serial/qcom_geni_serial.c | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c
> > index d98e0a8aae7c..61350007bf1c 100644
> > --- a/drivers/tty/serial/qcom_geni_serial.c
> > +++ b/drivers/tty/serial/qcom_geni_serial.c
> > @@ -1055,11 +1055,11 @@ static int setup_fifos(struct qcom_geni_serial_port *port)
> >         uport->fifosize =
> >                 (port->tx_fifo_depth * port->tx_fifo_width) / BITS_PER_BYTE;
> >
> > -       if (port->rx_fifo && (old_rx_fifo_depth != port->rx_fifo_depth) && port->rx_fifo_depth) {
> > -               port->rx_fifo = devm_krealloc(uport->dev, port->rx_fifo,
> > +       if (port->rx_buf && (old_rx_fifo_depth != port->rx_fifo_depth) && port->rx_fifo_depth) {
> > +               port->rx_buf = devm_krealloc(uport->dev, port->rx_buf,
> >                                               port->rx_fifo_depth * sizeof(u32),
> >                                               GFP_KERNEL);
> > -               if (!port->rx_fifo)
> > +               if (!port->rx_buf)
> >                         return -ENOMEM;
> >         }
> >
> > --
> > 2.35.1
> >
> > --
> > Cheers,
> > Stephen Rothwell
> 
> This looks fine and works fine:
> 
> Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> Tested-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

Thanks for this, someone else just sent the same thing, I've queued it
up too.

greg k-h
  

Patch

diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c
index d98e0a8aae7c..61350007bf1c 100644
--- a/drivers/tty/serial/qcom_geni_serial.c
+++ b/drivers/tty/serial/qcom_geni_serial.c
@@ -1055,11 +1055,11 @@  static int setup_fifos(struct qcom_geni_serial_port *port)
 	uport->fifosize =
 		(port->tx_fifo_depth * port->tx_fifo_width) / BITS_PER_BYTE;
 
-	if (port->rx_fifo && (old_rx_fifo_depth != port->rx_fifo_depth) && port->rx_fifo_depth) {
-		port->rx_fifo = devm_krealloc(uport->dev, port->rx_fifo,
+	if (port->rx_buf && (old_rx_fifo_depth != port->rx_fifo_depth) && port->rx_fifo_depth) {
+		port->rx_buf = devm_krealloc(uport->dev, port->rx_buf,
 					      port->rx_fifo_depth * sizeof(u32),
 					      GFP_KERNEL);
-		if (!port->rx_fifo)
+		if (!port->rx_buf)
 			return -ENOMEM;
 	}