lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a9b2899a-bbd4-ec15-6fcc-b7765455ea13@kernel.org>
Date:   Tue, 15 Feb 2022 07:14:46 +0100
From:   Jiri Slaby <jirislaby@...nel.org>
To:     Qing Wang <wangqing@...o.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        linux-serial@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] tty: serial: add missing pci_dev_put() before return

On 15. 02. 22, 3:01, Qing Wang wrote:
> From: Wang Qing <wangqing@...o.com>
> 
> pci_get_slot() increases its reference count, the caller must
> decrement the reference count by calling pci_dev_put()
> 
> Signed-off-by: Wang Qing <wangqing@...o.com>
> ---
>   drivers/tty/serial/pch_uart.c | 7 +++++--
>   1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c
> index f0351e6..da5a276
> --- a/drivers/tty/serial/pch_uart.c
> +++ b/drivers/tty/serial/pch_uart.c
> @@ -723,7 +723,7 @@ static void pch_request_dma(struct uart_port *port)
>   	if (!chan) {
>   		dev_err(priv->port.dev, "%s:dma_request_channel FAILS(Tx)\n",
>   			__func__);
> -		return;
> +		goto out;
>   	}
>   	priv->chan_tx = chan;
>   
> @@ -739,13 +739,16 @@ static void pch_request_dma(struct uart_port *port)
>   			__func__);
>   		dma_release_channel(priv->chan_tx);
>   		priv->chan_tx = NULL;
> -		return;
> +		goto out;
>   	}
>   
>   	/* Get Consistent memory for DMA */
>   	priv->rx_buf_virt = dma_alloc_coherent(port->dev, port->fifosize,
>   				    &priv->rx_buf_dma, GFP_KERNEL);
>   	priv->chan_rx = chan;
> +
> +out:
> +	pci_dev_put(dma_dev);

Again, dma_dev is stored to an internal structure and shouldn't be freed 
now.

>   }
>   
>   static void pch_dma_rx_complete(void *arg)


-- 
js
suse labs

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ