Skip to contentSkip to conversation

bluetooth:Fix concurrent access issue in the function chan_close_cb

PATCH RESEND Superseded Nicholas Krause 1 participant 1 message Dec 20, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 bluetooth:Fix concurrent access issue in the function chan_close_cb

This fixes a concurrent access issue in the function chan_close_cb by not locking and unlocking around the function peer_lockup_chan by use of the function locking pair rcu_read_lock/unlock in order to have actual protection from concurrent threads of execution when calling this particular function in the function chan_close_cb.

---
 net/bluetooth/6lowpan.c | 2 ++
 1 file changed, 2 insertions(+)
net/bluetooth/6lowpan.c +2 -0
index 2fb7b30..7fc20cb 100644
@@ -955,7 +955,9 @@ static void chan_close_cb(struct l2cap_chan *chan)
 
 	list_for_each_entry_rcu(entry, &bt_6lowpan_devices, list) {
 		dev = lowpan_dev(entry->netdev);
+		rcu_read_lock();
 		peer = __peer_lookup_chan(dev, chan);
+		rcu_read_unlock();
 		if (peer) {
 			last = peer_del(dev, peer);
 			err = 0;
Signature · 1 line
2.1.4