xfrm: Perform a replay check after return from async codepaths
[firefly-linux-kernel-4.4.55.git] / net / xfrm / xfrm_input.c
index a026b0ef2443ce3150417059691434a4926ba108..54a0dc2e2f8d45d7a842be98882969f696c07ec2 100644 (file)
@@ -212,6 +212,11 @@ resume:
                /* only the first xfrm gets the encap type */
                encap_type = 0;
 
+               if (async && x->repl->check(x, skb, seq)) {
+                       XFRM_INC_STATS(net, LINUX_MIB_XFRMINSTATESEQERROR);
+                       goto drop_unlock;
+               }
+
                x->repl->advance(x, seq);
 
                x->curlft.bytes += skb->len;