All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Cc: jirislaby@kernel.org, linux-serial@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] serial: pch_uart: potential dereference of null pointer
Date: Thu, 16 Dec 2021 14:15:14 +0100	[thread overview]
Message-ID: <Ybs74r4fjDudyJ4C@kroah.com> (raw)
In-Reply-To: <20211216125121.399938-1-jiasheng@iscas.ac.cn>

On Thu, Dec 16, 2021 at 08:51:21PM +0800, Jiasheng Jiang wrote:
> The return value of dma_alloc_coherent() needs to be checked.
> To avoid dereference of null pointer in case of the failure of alloc.
> 
> Fixes: ab4382d27412 ("tty: move drivers/serial/ to drivers/tty/serial/")

That is not the commit that caused the problem :(

> Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
> ---
> Changelog:
> 
> v1 -> v2
> 
> *Change 1. Add the dev_err when dma_alloc_coherent failed.
> ---
>  drivers/tty/serial/pch_uart.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c
> index f0351e6f0ef6..d19ed7da24fa 100644
> --- a/drivers/tty/serial/pch_uart.c
> +++ b/drivers/tty/serial/pch_uart.c
> @@ -745,6 +745,14 @@ static void pch_request_dma(struct uart_port *port)
>  	/* Get Consistent memory for DMA */
>  	priv->rx_buf_virt = dma_alloc_coherent(port->dev, port->fifosize,
>  				    &priv->rx_buf_dma, GFP_KERNEL);
> +	if (!priv->rx_buf_virt) {
> +		dev_err(priv->port.dev, "%s:dma_alloc_coherent FAILS(Rx)\n",
> +			__func__);
> +		dma_release_channel(priv->chan_tx);
> +		priv->chan_tx = NULL;
> +		return;

You seemed to have ignored my previous review comments on this change
for some reason :(

This is not correct.

greg k-h

      reply	other threads:[~2021-12-16 13:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-16 12:51 [PATCH v2] serial: pch_uart: potential dereference of null pointer Jiasheng Jiang
2021-12-16 13:15 ` Greg KH [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Ybs74r4fjDudyJ4C@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=jiasheng@iscas.ac.cn \
    --cc=jirislaby@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.