From: Steffen Klassert Date: Mon, 25 Apr 2011 19:39:24 +0000 (+0000) Subject: xfrm: Fix replay window size calculation on initialization X-Git-Tag: v3.12-rc1~6157^2~51 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3f602b08dec32c418fc391fc838db357aab84f8a;p=kernel%2Fkernel-generic.git 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: Steffen Klassert Acked-by: Herbert Xu Signed-off-by: David S. Miller --- diff --git a/net/xfrm/xfrm_replay.c b/net/xfrm/xfrm_replay.c index f218385..e8a7814 100644 --- a/net/xfrm/xfrm_replay.c +++ b/net/xfrm/xfrm_replay.c @@ -532,7 +532,7 @@ int xfrm_init_replay(struct xfrm_state *x) if (replay_esn) { if (replay_esn->replay_window > - replay_esn->bmp_len * sizeof(__u32)) + replay_esn->bmp_len * sizeof(__u32) * 8) return -EINVAL; if ((x->props.flags & XFRM_STATE_ESN) && x->replay_esn)