Skip to content

Commit bcf66bf

Browse files
klassertdavem330
authored andcommitted
xfrm: Perform a replay check after return from async codepaths
When asyncronous crypto algorithms are used, there might be many packets that passed the xfrm replay check, but the replay advance function is not called yet for these packets. So the replay check function would accept a replay of all of these packets. Also the system might crash if there are more packets in async processing than the size of the anti replay window, because the replay advance function would try to update the replay window beyond the bounds. This pach adds a second replay check after resuming from the async processing to fix these issues. Signed-off-by: Steffen Klassert <[email protected]> Acked-by: Herbert Xu <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 561dac2 commit bcf66bf

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

net/xfrm/xfrm_input.c

+5
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,11 @@ int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type)
212212
/* only the first xfrm gets the encap type */
213213
encap_type = 0;
214214

215+
if (async && x->repl->check(x, skb, seq)) {
216+
XFRM_INC_STATS(net, LINUX_MIB_XFRMINSTATESEQERROR);
217+
goto drop_unlock;
218+
}
219+
215220
x->repl->advance(x, seq);
216221

217222
x->curlft.bytes += skb->len;

0 commit comments

Comments
 (0)