Commit ef846bc0 authored by Herbert Xu's avatar Herbert Xu Committed by Adrian Bunk

[IPSEC]: Reject packets within replay window but outside the bit mask

Up until this point we've accepted replay window settings greater than
32 but our bit mask can only accomodate 32 packets.  Thus any packet
with a sequence number within the window but outside the bit mask would
be accepted.

This patch causes those packets to be rejected instead.
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarAdrian Bunk <bunk@stusta.de>
parent 19a0662b
...@@ -776,7 +776,8 @@ int xfrm_replay_check(struct xfrm_state *x, u32 seq) ...@@ -776,7 +776,8 @@ int xfrm_replay_check(struct xfrm_state *x, u32 seq)
return 0; return 0;
diff = x->replay.seq - seq; diff = x->replay.seq - seq;
if (diff >= x->props.replay_window) { if (diff >= min_t(unsigned int, x->props.replay_window,
sizeof(x->replay.bitmap) * 8)) {
x->stats.replay_window++; x->stats.replay_window++;
return -EINVAL; return -EINVAL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment