Skip to content

Commit

Permalink
xfrm_user: don't copy esn replay window twice for new states
Browse files Browse the repository at this point in the history
The ESN replay window was already fully initialized in
xfrm_alloc_replay_state_esn(). No need to copy it again.

Cc: Steffen Klassert <[email protected]>
Signed-off-by: Mathias Krause <[email protected]>
Acked-by: Steffen Klassert <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
minipli authored and davem330 committed Sep 20, 2012
1 parent ecd7918 commit e3ac104
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions net/xfrm/xfrm_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -461,10 +461,11 @@ static void copy_from_user_state(struct xfrm_state *x, struct xfrm_usersa_info *
* somehow made shareable and move it to xfrm_state.c - JHS
*
*/
static void xfrm_update_ae_params(struct xfrm_state *x, struct nlattr **attrs)
static void xfrm_update_ae_params(struct xfrm_state *x, struct nlattr **attrs,
int update_esn)
{
struct nlattr *rp = attrs[XFRMA_REPLAY_VAL];
struct nlattr *re = attrs[XFRMA_REPLAY_ESN_VAL];
struct nlattr *re = update_esn ? attrs[XFRMA_REPLAY_ESN_VAL] : NULL;
struct nlattr *lt = attrs[XFRMA_LTIME_VAL];
struct nlattr *et = attrs[XFRMA_ETIMER_THRESH];
struct nlattr *rt = attrs[XFRMA_REPLAY_THRESH];
Expand Down Expand Up @@ -574,7 +575,7 @@ static struct xfrm_state *xfrm_state_construct(struct net *net,
goto error;

/* override default values from above */
xfrm_update_ae_params(x, attrs);
xfrm_update_ae_params(x, attrs, 0);

return x;

Expand Down Expand Up @@ -1848,7 +1849,7 @@ static int xfrm_new_ae(struct sk_buff *skb, struct nlmsghdr *nlh,
goto out;

spin_lock_bh(&x->lock);
xfrm_update_ae_params(x, attrs);
xfrm_update_ae_params(x, attrs, 1);
spin_unlock_bh(&x->lock);

c.event = nlh->nlmsg_type;
Expand Down

0 comments on commit e3ac104

Please sign in to comment.