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: <3c4e744f-c313-e195-af93-a22382c81bb6@kernel.org>
Date:   Tue, 3 Jan 2023 10:00:48 +0100
From:   Jiri Slaby <jirislaby@...nel.org>
To:     Deepak R Varma <drv@...lo.com>,
        "Maciej W. Rozycki" <macro@...am.me.uk>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        linux-serial@...r.kernel.org, linux-kernel@...r.kernel.org
Cc:     Saurabh Singh Sengar <ssengar@...rosoft.com>,
        Praveen Kumar <kumarpraveen@...ux.microsoft.com>
Subject: Re: [PATCH v4 2/2] tty: serial: dz: convert atomic_* to refcount_*
 APIs for irq_guard

On 26. 12. 22, 7:21, Deepak R Varma wrote:
> The refcount_* APIs are designed to address known issues with the
> atomic_t APIs for reference counting. They provide following distinct
> advantages:
>     - protect the reference counters from overflow/underflow
>     - avoid use-after-free errors
>     - provide improved memory ordering guarantee schemes
>     - neater and safer.
> Hence, replace the atomic_* APIs by their equivalent refcount_t
> API functions.
> 
> This patch proposal address the following warnings generated by
> the atomic_as_refcounter.cocci coccinelle script
> atomic_add_return(-1, ...)
...
> --- a/drivers/tty/serial/dz.c
> +++ b/drivers/tty/serial/dz.c
...
> @@ -400,18 +399,16 @@ static int dz_startup(struct uart_port *uport)
>   	struct dz_port *dport = to_dport(uport);
>   	struct dz_mux *mux = dport->mux;
>   	unsigned long flags;
> -	int irq_guard;
>   	int ret;
>   	u16 tmp;
> 
> -	irq_guard = atomic_add_return(1, &mux->irq_guard);
> -	if (irq_guard != 1)
> +	refcount_inc(&mux->irq_guard);
> +	if (refcount_read(&mux->irq_guard) != 1)
>   		return 0;
> 
> -	ret = request_irq(dport->port.irq, dz_interrupt,
> -			  IRQF_SHARED, "dz", mux);
> +	ret = request_irq(dport->port.irq, dz_interrupt, IRQF_SHARED, "dz", mux);

How is this related to the above described change?

-- 
js
suse labs

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ