Skip to contentSkip to conversation

macvtap: remove wrong sock_put() in macvtap_put_queue()

PATCH In review Jason Wang 2 participants 2 messages Jun 13, 2011 – Jun 17, 2011

Subsystems (2)
lore
Share & tools
lore

Jason Wang

author
#0 lore raw

PATCH 1/1 macvtap: remove wrong sock_put() in macvtap_put_queue()

The calling of sock_put() should be delayed after synchronize_rcu(), otherwise inconsist data may be seen during packets transmitting.

---
 drivers/net/macvtap.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
drivers/net/macvtap.c +0 -1
index 6696e56..ecdb775 100644
@@ -148,7 +148,6 @@ static void macvtap_put_queue(struct macvtap_queue *q)
 
 		rcu_assign_pointer(vlan->taps[index], NULL);
 		rcu_assign_pointer(q->vlan, NULL);
-		sock_put(&q->sk);
 		--vlan->numvtaps;
 	}
 
Signature · 1 line
1.7.1
maintainer
#1 lore raw

From: Jason Wang <[email protected]>
Date: Mon, 13 Jun 2011 11:15:19 +0800

Quoted 4 lines

The calling of sock_put() should be delayed after synchronize_rcu(), otherwise inconsist data may be seen during packets transmitting.

You're leaking sockets now.

This function has to release the socket twice if there is a non-NULL vlan assigned to the queue.

Now you're only doing it once in that situation.

Which probably fixes your crash, but adds a socket leak.