Patchwork xfrm: check if packet is overdue on asynchronous code path

login
register
mail settings
Submitter roy.qing.li@gmail.com
Date Jan. 11, 2013, 8:12 a.m.
Message ID <1357891965-8047-1-git-send-email-roy.qing.li@gmail.com>
Download mbox | patch
Permalink /patch/211236/
State Awaiting Upstream
Delegated to: David Miller
Headers show

Comments

roy.qing.li@gmail.com - Jan. 11, 2013, 8:12 a.m.
From: Li RongQing <roy.qing.li@gmail.com>

Currently checking is only done on synchronous code path,
we should do the same checking on asynchronous code path.

Signed-off-by: Li RongQing <roy.qing.li@gmail.com>
---
 net/xfrm/xfrm_input.c |    6 ++++++
 1 file changed, 6 insertions(+)
Steffen Klassert - Jan. 11, 2013, 8:29 a.m.
On Fri, Jan 11, 2013 at 04:12:45PM +0800, roy.qing.li@gmail.com wrote:
> From: Li RongQing <roy.qing.li@gmail.com>
> 
> Currently checking is only done on synchronous code path,
> we should do the same checking on asynchronous code path.

We do this check already before we enter the asynchronous code path,
there is no need to do this check again.

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/net/xfrm/xfrm_input.c b/net/xfrm/xfrm_input.c
index ab2bb42..d034324 100644
--- a/net/xfrm/xfrm_input.c
+++ b/net/xfrm/xfrm_input.c
@@ -199,6 +199,12 @@  int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type)
 
 resume:
 		spin_lock(&x->lock);
+
+		if (async && xfrm_state_check_expire(x)) {
+			XFRM_INC_STATS(net, LINUX_MIB_XFRMINSTATEEXPIRED);
+			goto drop_unlock;
+		}
+
 		if (nexthdr <= 0) {
 			if (nexthdr == -EBADMSG) {
 				xfrm_audit_state_icvfail(x, skb,