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: <87v7qmp1t1.ffs@tglx>
Date: Wed, 30 Apr 2025 09:04:58 +0200
From: Thomas Gleixner <tglx@...utronix.de>
To: Su Hui <suhui@...china.com>, jstultz@...gle.com, sboyd@...nel.org
Cc: Su Hui <suhui@...china.com>, dan.carpenter@...aro.org,
 linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: Re: [PATCH v3 3/3] alarmtimer: switch some
 spin_{lock,unlock}_irqsave() to guard()

On Wed, Apr 30 2025 at 11:27, Su Hui wrote:
> -	spin_lock_irqsave(&rtcdev_lock, flags);
> -	if (!IS_ERR(pdev) && !rtcdev) {
> -		if (!try_module_get(rtc->owner)) {
> +	scoped_guard(spinlock_irqsave, &rtcdev_lock) {
> +		if (!IS_ERR(pdev) && !rtcdev) {
> +			if (!try_module_get(rtc->owner)) {
> +				ret = -1;
> +				break;

This really reads odd and relies on the internals of scoped_guard(). I
actually had to look at the scoped_guard() implementation to validate
it.

The whole thing can be simplified to:

 	scoped_guard(spinlock_irqsave, &rtcdev_lock) {
		if (!IS_ERR(pdev) && !rtcdev && try_module_get(rtc->owner)) {
 			rtcdev = rtc;
 			/* hold a reference so it doesn't go away */
 			get_device(dev);
                        pdev = NULL;
		} else {
 			ret = -1;
		}

No?

No need to resend. I fixed it up already.

Thanks,

        tglx

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ