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-next>] [day] [month] [year] [list]
Message-ID: <20140904171548.GA3265@ada>
Date:	Thu, 4 Sep 2014 20:15:48 +0300
From:	Andreea-Cristina Bernat <bernat.ada@...il.com>
To:	gregkh@...uxfoundation.org, Larry.Finger@...inger.net,
	navin.patidar@...il.com, devel@...verdev.osuosl.org,
	linux-kernel@...r.kernel.org
Cc:	paulmck@...ux.vnet.ibm.com
Subject: [PATCH] rtl8188eu: rtw_xmit: Replace rcu_dereference() with
 rcu_access_pointer()

The "br_port" local variables obtained through the rcu_dereference() calls are
not dereferenced in the rest of their function.
Therefore, it is recommended to use rcu_access_pointer() instead of
rcu_dereference().
This patch makes the replacements.

The first step to detect this was made with the following Coccinelle semantic
patch:
@@
identifier p;
@@

* p = rcu_dereference(...)
... when any
    when != p
(
* if( (<+...p...+>) ) { ... }
|
* while( (<+...p...+>) ) { ... }
)
... when != p

After the analysis of the output, the change was made manually.

Signed-off-by: Andreea-Cristina Bernat <bernat.ada@...il.com>
---
 drivers/staging/rtl8188eu/core/rtw_xmit.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_xmit.c b/drivers/staging/rtl8188eu/core/rtw_xmit.c
index 1413ec8..93228dc 100644
--- a/drivers/staging/rtl8188eu/core/rtw_xmit.c
+++ b/drivers/staging/rtl8188eu/core/rtw_xmit.c
@@ -1684,7 +1684,7 @@ static int rtw_br_client_tx(struct adapter *padapter, struct sk_buff **pskb)
 	void *br_port = NULL;
 
 	rcu_read_lock();
-	br_port = rcu_dereference(padapter->pnetdev->rx_handler_data);
+	br_port = rcu_access_pointer(padapter->pnetdev->rx_handler_data);
 	rcu_read_unlock();
 	spin_lock_bh(&padapter->br_ext_lock);
 	if (!(skb->data[0] & 1) && br_port &&
@@ -1868,7 +1868,7 @@ s32 rtw_xmit(struct adapter *padapter, struct sk_buff **ppkt)
 	}
 
 	rcu_read_lock();
-	br_port = rcu_dereference(padapter->pnetdev->rx_handler_data);
+	br_port = rcu_access_pointer(padapter->pnetdev->rx_handler_data);
 	rcu_read_unlock();
 
 	if (br_port && check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE)) {
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ