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: <d9c7a2ba-288a-d81a-cd59-5b002489d821@lwfinger.net>
Date:   Sat, 2 Apr 2022 16:32:50 -0500
From:   Larry Finger <Larry.Finger@...inger.net>
To:     Michael Straube <straube.linux@...il.com>,
        Greg KH <gregkh@...uxfoundation.org>
Cc:     Phillip Potter <phil@...lpotter.co.uk>,
        "open list:STAGING SUBSYSTEM" <linux-staging@...ts.linux.dev>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: staging: r8188eu: how to handle nested mutex under spinlock

On 4/2/22 15:47, Michael Straube wrote:
> Hi all,
> 
> smatch reported a sleeping in atomic context.
> 
> rtw_set_802_11_disassociate() <- disables preempt
> -> _rtw_pwr_wakeup()
>     -> ips_leave()
> 
> rtw_set_802_11_disassociate() takes a spinlock and ips_leave() uses a
> mutex.
> 
> I'm fairly new to the locking stuff, but as far as I know this is not a
> false positive since mutex can sleep, but that's not allowed under a
> spinlock.
> 
> What is the best way to handle this?
> I'm not sure if converting the mutex to a spinlock (including all the
> other places where the mutex is used) is the right thing to do?

In drivers/net/wireless/realtek/rtlwifi, we had a similar problem. There it was 
handled by putting the lps_enter() and lps_leave() operations in a separate 
workqueue. In this case, the routines were rtl_lps_enter() and rtl_lps_leave(). 
Each of them sets a variable to indicate whether enter_ps is true or false, and 
schedules the workqueue. In the workqueue's callback routine, the routines to 
start/stop ps mode are called. The code is in 
drivers/net/wireless/realtek/rtlwifi/ps.c.

This solution is only one of many, and there may be a better one.

Larry

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ