Netdev List
 help / color / mirror / Atom feed
* [PATCH net-next 1/3] xfrm: Fix xfrm_replay_overflow_offload_esn
@ 2017-11-28  9:49 yossefe
  2017-11-28  9:49 ` [PATCH net-next 2/3] xfrm: Fix xfrm_dev_state_add to fail for unsupported HW SA option yossefe
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: yossefe @ 2017-11-28  9:49 UTC (permalink / raw)
  To: David S. Miller, Steffen Klassert, Herbert Xu, netdev,
	linux-kernel
  Cc: borisp, kliteyn, yossiku, Yossef Efraim

From: Yossef Efraim <yossefe@mellanox.com>

In case of wrap around, replay_esn->oseq_hi is not updated
before it is tested for it's actual value, leading function
to fail with overflow indication and packets being dropped.

This patch updates replay_esn->oseq_hi in the right place.

Fixes: d7dbefc45cf5 ("xfrm: Add xfrm_replay_overflow functions for offloading")
Signed-off-by: Yossef Efraim <yossefe@mellanox.com>
---
 net/xfrm/xfrm_replay.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/net/xfrm/xfrm_replay.c b/net/xfrm/xfrm_replay.c
index 8b23c5b..0250181 100644
--- a/net/xfrm/xfrm_replay.c
+++ b/net/xfrm/xfrm_replay.c
@@ -666,7 +666,7 @@ static int xfrm_replay_overflow_offload_esn(struct xfrm_state *x, struct sk_buff
 		if (unlikely(oseq < replay_esn->oseq)) {
 			XFRM_SKB_CB(skb)->seq.output.hi = ++oseq_hi;
 			xo->seq.hi = oseq_hi;
-
+			replay_esn->oseq_hi = oseq_hi;
 			if (replay_esn->oseq_hi == 0) {
 				replay_esn->oseq--;
 				replay_esn->oseq_hi--;
@@ -678,7 +678,6 @@ static int xfrm_replay_overflow_offload_esn(struct xfrm_state *x, struct sk_buff
 		}
 
 		replay_esn->oseq = oseq;
-		replay_esn->oseq_hi = oseq_hi;
 
 		if (xfrm_aevent_is_on(net))
 			x->repl->notify(x, XFRM_REPLAY_UPDATE);
-- 
2.8.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2018-01-10 11:37 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-28  9:49 [PATCH net-next 1/3] xfrm: Fix xfrm_replay_overflow_offload_esn yossefe
2017-11-28  9:49 ` [PATCH net-next 2/3] xfrm: Fix xfrm_dev_state_add to fail for unsupported HW SA option yossefe
2017-12-01  6:21   ` Steffen Klassert
2017-11-28  9:49 ` [PATCH net-next 3/3] xfrm: Add ESN support for IPSec HW offload yossefe
2017-12-01  6:23   ` Steffen Klassert
2017-12-01 19:23     ` Shannon Nelson
2018-01-10 10:35     ` Yossef Efraim
2017-12-01 19:23   ` Shannon Nelson
2018-01-10 11:37     ` Yossef Efraim
2017-12-01  6:20 ` [PATCH net-next 1/3] xfrm: Fix xfrm_replay_overflow_offload_esn Steffen Klassert

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox