OpenVZ Forum


Home » Mailing lists » Devel » [PATCH][PKTGEN] Fix double unlock of xfrm_state->lock
[PATCH][PKTGEN] Fix double unlock of xfrm_state->lock [message #23503] Mon, 19 November 2007 09:47 Go to next message
Pavel Emelianov is currently offline  Pavel Emelianov
Messages: 1149
Registered: September 2006
Senior Member
The pktgen_output_ipsec() function can unlock this lock twice
due to merged error and plain paths. Remove one of the calls
to spin_unlock.

Other possible solution would be to place "return 0" right 
after the first unlock, but at this place the err is known 
to be 0, so these solutions are the same except for this one
makes the code shorter.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>

---

diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index de33f36..285ec3e 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -2463,8 +2463,6 @@ static int pktgen_output_ipsec(struct sk_buff *skb, struct pktgen_dev *pkt_dev)
 
 	x->curlft.bytes +=skb->len;
 	x->curlft.packets++;
-	spin_unlock(&x->lock);
-
 error:
 	spin_unlock(&x->lock);
 	return err;
Re: [PATCH][PKTGEN] Fix double unlock of xfrm_state->lock [message #23521 is a reply to message #23503] Mon, 19 November 2007 16:18 Go to previous messageGo to next message
jamal is currently offline  jamal
Messages: 12
Registered: June 2006
Junior Member
On Mon, 2007-19-11 at 12:47 +0300, Pavel Emelyanov wrote:
> The pktgen_output_ipsec() function can unlock this lock twice
> due to merged error and plain paths. Remove one of the calls
> to spin_unlock.

Good catch.
Acked-by: Jamal Hadi Salim <hadi@cyberus.ca>

cheers,
jamal
Re: [PATCH][PKTGEN] Fix double unlock of xfrm_state->lock [message #23543 is a reply to message #23503] Tue, 20 November 2007 06:51 Go to previous message
davem is currently offline  davem
Messages: 463
Registered: February 2006
Senior Member
From: Pavel Emelyanov <xemul@openvz.org>
Date: Mon, 19 Nov 2007 12:47:00 +0300

> The pktgen_output_ipsec() function can unlock this lock twice
> due to merged error and plain paths. Remove one of the calls
> to spin_unlock.
> 
> Other possible solution would be to place "return 0" right 
> after the first unlock, but at this place the err is known 
> to be 0, so these solutions are the same except for this one
> makes the code shorter.
> 
> Signed-off-by: Pavel Emelyanov <xemul@openvz.org>

Applied, thanks Pavel.
Previous Topic: [PATCH 6/6 net-2.6.25][RAW] Consolidate proc interface (v2)
Next Topic: [PATCH][IPVS] Relax the module get/put in ip_vs_app.c
Goto Forum:
  


Current Time: Sun May 28 02:19:19 GMT 2023

Total time taken to generate the page: 0.01327 seconds