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]
Date:   Wed, 19 May 2021 12:26:05 -0700 (PDT)
From:   David Miller <davem@...emloft.net>
To:     zheyuma97@...il.com
Cc:     GR-Linux-NIC-Dev@...vell.com, kuba@...nel.org,
        netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] net/qla3xxx: fix schedule while atomic in
 ql_sem_spinlock

From: Zheyu Ma <zheyuma97@...il.com>
Date: Wed, 19 May 2021 06:49:14 +0000

> When calling the 'ql_sem_spinlock', the driver has already acquired the
> spin lock, so the driver should not call 'ssleep' in atomic context.
> 
> This bug can be fixed by unlocking before calling 'ssleep'.
 ...
> diff --git a/drivers/net/ethernet/qlogic/qla3xxx.c b/drivers/net/ethernet/qlogic/qla3xxx.c
> index 214e347097a7..af7c142a066f 100644
> --- a/drivers/net/ethernet/qlogic/qla3xxx.c
> +++ b/drivers/net/ethernet/qlogic/qla3xxx.c
> @@ -114,7 +114,9 @@ static int ql_sem_spinlock(struct ql3_adapter *qdev,
>  		value = readl(&port_regs->CommonRegs.semaphoreReg);
>  		if ((value & (sem_mask >> 16)) == sem_bits)
>  			return 0;
> +		spin_unlock_irq(&qdev->hw_lock);
>  		ssleep(1);
> +		spin_lock_irq(&qdev->hw_lock);
>  	} while (--seconds);
>  	return -1;
>  }

Are you sure dropping the lock like this dos not introduce a race condition?

Thank you.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ