Skip to contentSkip to conversation

Fix double unlock of xfrm_state->lock

PATCH Applied Pavel Emelyanov 3 participants 3 messages Nov 19, 2007 – Nov 20, 2007

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

PATCH 1/1 Fix double unlock of xfrm_state->lock

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.

---

net/core/pktgen.c +0 -2
index de33f36..285ec3e 100644
@@ -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;
Acked-by on v1 1/1
#1 lore raw
Quoted 3 lines · Pavel Emelyanov

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.

cheers,
jamal

maintainer Applied
#2 lore raw
In reply to Pavel Emelyanov

From: Pavel Emelyanov <[email protected]>
Date: Mon, 19 Nov 2007 12:47:00 +0300

Quoted 10 lines

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.

Applied, thanks Pavel.