Commit 3f602b08 authored by Steffen Klassert's avatar Steffen Klassert Committed by David S. Miller

xfrm: Fix replay window size calculation on initialization

On replay initialization, we compute the size of the replay
buffer to see if the replay window fits into the buffer.
This computation lacks a mutliplication by 8 because we need
the size in bit, not in byte. So we might return an error
even though the replay window would fit into the buffer.
This patch fixes this issue.
Signed-off-by: default avatarSteffen Klassert <steffen.klassert@secunet.com>
Acked-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 0972ddb2
...@@ -532,7 +532,7 @@ int xfrm_init_replay(struct xfrm_state *x) ...@@ -532,7 +532,7 @@ int xfrm_init_replay(struct xfrm_state *x)
if (replay_esn) { if (replay_esn) {
if (replay_esn->replay_window > if (replay_esn->replay_window >
replay_esn->bmp_len * sizeof(__u32)) replay_esn->bmp_len * sizeof(__u32) * 8)
return -EINVAL; return -EINVAL;
if ((x->props.flags & XFRM_STATE_ESN) && x->replay_esn) if ((x->props.flags & XFRM_STATE_ESN) && x->replay_esn)
......
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