All of lore.kernel.org
 help / color / mirror / Atom feed
* [ldv-project] [net] rtl8188ee: a potential race condition
@ 2016-06-10  8:21 Pavel Andrianov
  2016-06-24 14:17 ` Vaishali Thakkar
  0 siblings, 1 reply; 3+ messages in thread
From: Pavel Andrianov @ 2016-06-10  8:21 UTC (permalink / raw)
  To: Larry Finger
  Cc: Chaoming Li, Kalle Valo, linux-wireless, netdev, linux-kernel,
	Vaishali Thakkar, ldv-project

Hi!

There is a potential data race in 
drivers/net/wireless/realtek/rtlwifi/rtl8188ee/rtl8188ee.ko.

In the function rtl88ee_gpio_radio_on_off_checking the flag 
ppsc->rfchange_inprogress is set with a spinlock protection. In the 
function rtl_ps_set_rf_state the flag is read also under a spinlock. But 
the function rtl88e_dm_watchdog read it without any locks. As a result 
rtl88e_dm_watchdog may execute the succeeding code while changing (with 
the flag rfchange_inprogress == true). I do not exactly determine the 
consequences, but likely they are not good if there exists such check. 
Could anybody more confident confirm this?

The function rtl_ps_set_rf_state is always called with its parameter 
[protect_or_not == false]. Is this flag really necessary, if the value 
'true' is never used? The function is also set the flag 
ppsc->rfchange_inprogress and may affect the rtl88e_dm_watchdog as in 
the previous case.

-- 
Pavel Andrianov
Linux Verification Center, ISPRAS
web: http://linuxtesting.org
e-mail: andrianov@ispras.ru


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [ldv-project] [net] rtl8188ee: a potential race condition
  2016-06-10  8:21 [ldv-project] [net] rtl8188ee: a potential race condition Pavel Andrianov
@ 2016-06-24 14:17 ` Vaishali Thakkar
  2016-06-24 14:46   ` Larry Finger
  0 siblings, 1 reply; 3+ messages in thread
From: Vaishali Thakkar @ 2016-06-24 14:17 UTC (permalink / raw)
  To: Pavel Andrianov, Larry Finger
  Cc: Chaoming Li, Kalle Valo, linux-wireless, netdev, linux-kernel,
	ldv-project



On Friday 10 June 2016 01:51 PM, Pavel Andrianov wrote:
> Hi!
> 
> There is a potential data race in drivers/net/wireless/realtek/rtlwifi/rtl8188ee/rtl8188ee.ko.
> 
> In the function rtl88ee_gpio_radio_on_off_checking the flag ppsc->rfchange_inprogress is set with a spinlock protection. In the function rtl_ps_set_rf_state the flag is read also under a spinlock. But the function rtl88e_dm_watchdog read it without any locks. As a result rtl88e_dm_watchdog may execute the succeeding code while changing (with the flag rfchange_inprogress == true). I do not exactly determine the consequences, but likely they are not good if there exists such check. Could anybody more confident confirm this?
> 
> The function rtl_ps_set_rf_state is always called with its parameter [protect_or_not == false]. Is this flag really necessary, if the value 'true' is never used? The function is also set the flag ppsc->rfchange_inprogress and may affect the rtl88e_dm_watchdog as in the previous case.

I think the patch was sent sometime ago for removing the parameter. But I am not sure why it's not applied.
May be Larry can have better idea about this.

Here, is link to the patch: http://linux-wireless.vger.kernel.narkive.com/mu4t9xxr/patch-3-4-rtlwifi-rtl8192cu-remove-unused-parameter

-- 
Vaishali

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [ldv-project] [net] rtl8188ee: a potential race condition
  2016-06-24 14:17 ` Vaishali Thakkar
@ 2016-06-24 14:46   ` Larry Finger
  0 siblings, 0 replies; 3+ messages in thread
From: Larry Finger @ 2016-06-24 14:46 UTC (permalink / raw)
  To: Vaishali Thakkar, Pavel Andrianov
  Cc: Chaoming Li, Kalle Valo, linux-wireless, netdev, linux-kernel,
	ldv-project

On 06/24/2016 09:17 AM, Vaishali Thakkar wrote:
>
>
> On Friday 10 June 2016 01:51 PM, Pavel Andrianov wrote:
>> Hi!
>>
>> There is a potential data race in drivers/net/wireless/realtek/rtlwifi/rtl8188ee/rtl8188ee.ko.
>>
>> In the function rtl88ee_gpio_radio_on_off_checking the flag ppsc->rfchange_inprogress is set with a spinlock protection. In the function rtl_ps_set_rf_state the flag is read also under a spinlock. But the function rtl88e_dm_watchdog read it without any locks. As a result rtl88e_dm_watchdog may execute the succeeding code while changing (with the flag rfchange_inprogress == true). I do not exactly determine the consequences, but likely they are not good if there exists such check. Could anybody more confident confirm this?
>>
>> The function rtl_ps_set_rf_state is always called with its parameter [protect_or_not == false]. Is this flag really necessary, if the value 'true' is never used? The function is also set the flag ppsc->rfchange_inprogress and may affect the rtl88e_dm_watchdog as in the previous case.
>
> I think the patch was sent sometime ago for removing the parameter. But I am not sure why it's not applied.
> May be Larry can have better idea about this.
>
> Here, is link to the patch: http://linux-wireless.vger.kernel.narkive.com/mu4t9xxr/patch-3-4-rtlwifi-rtl8192cu-remove-unused-parameter

The patch for rtl8192cu was applied as commit 4b9d8d67b44a on Jun 20 2011, but 
the unused parameter was reintroduced as part of an update of the power-save 
code with commit d3feae41a347 on Sep 22 2014. My recollection is that Realtek 
envisioned a driver that needed this parameter to be true. As none has yet been 
introduced, I will prepare a patch to remove it again.

I am also testing a patch to remove the race condition in rtl8188ee.

Larry


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-06-24 14:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-10  8:21 [ldv-project] [net] rtl8188ee: a potential race condition Pavel Andrianov
2016-06-24 14:17 ` Vaishali Thakkar
2016-06-24 14:46   ` Larry Finger

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.