[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1386230239-31860-6-git-send-email-fan.du@windriver.com>
Date: Thu, 5 Dec 2013 15:57:19 +0800
From: Fan Du <fan.du@...driver.com>
To: <steffen.klassert@...unet.com>, <davem@...emloft.net>
CC: <netdev@...r.kernel.org>
Subject: [PATCH RFC 5/5] {pktgen, xfrm} Correct xfrm state lock usage when transforming
xfrm_state lock protects its state, i.e., VALID/DEAD and statistics,
not the transforming procedure, as both mode/type output functions
are reentrant.
Signed-off-by: Fan Du <fan.du@...driver.com>
---
net/core/pktgen.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index 6e30160..6fbce38 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -2499,8 +2499,6 @@ static int pktgen_output_ipsec(struct sk_buff *skb, struct pktgen_dev *pkt_dev)
if (x->props.mode == XFRM_MODE_TUNNEL)
__skb_dst_set_noref(skb, &pkt_dev->dst, true);
- spin_lock(&x->lock);
-
err = x->outer_mode->output(x, skb);
if (err)
goto error;
@@ -2508,10 +2506,11 @@ static int pktgen_output_ipsec(struct sk_buff *skb, struct pktgen_dev *pkt_dev)
if (err)
goto error;
+ spin_lock(&x->lock);
x->curlft.bytes += skb->len;
x->curlft.packets++;
-error:
spin_unlock(&x->lock);
+error:
return err;
}
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists