Commit 8598112d authored by Steffen Klassert's avatar Steffen Klassert

xfrm: Fix return value check of copy_sec_ctx.

A recent commit added an output_mark. When copying
this output_mark, the return value of copy_sec_ctx
is overwitten without a check. Fix this by copying
the output_mark before the security context.

Fixes: 077fbac4 ("net: xfrm: support setting an output mark.")
Signed-off-by: default avatarSteffen Klassert <steffen.klassert@secunet.com>
parent 47ebcc0b
...@@ -900,13 +900,13 @@ static int copy_to_user_state_extra(struct xfrm_state *x, ...@@ -900,13 +900,13 @@ static int copy_to_user_state_extra(struct xfrm_state *x,
ret = copy_user_offload(&x->xso, skb); ret = copy_user_offload(&x->xso, skb);
if (ret) if (ret)
goto out; goto out;
if (x->security)
ret = copy_sec_ctx(x->security, skb);
if (x->props.output_mark) { if (x->props.output_mark) {
ret = nla_put_u32(skb, XFRMA_OUTPUT_MARK, x->props.output_mark); ret = nla_put_u32(skb, XFRMA_OUTPUT_MARK, x->props.output_mark);
if (ret) if (ret)
goto out; goto out;
} }
if (x->security)
ret = copy_sec_ctx(x->security, skb);
out: out:
return ret; return ret;
} }
......
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