Skip to content

Commit d1e0e61

Browse files
f0rm2l1nklassert
authored andcommitted
net: xfrm: Amend XFRMA_SEC_CTX nla_policy structure
According to all consumers code of attrs[XFRMA_SEC_CTX], like * verify_sec_ctx_len(), convert to xfrm_user_sec_ctx* * xfrm_state_construct(), call security_xfrm_state_alloc whose prototype is int security_xfrm_state_alloc(.., struct xfrm_user_sec_ctx *sec_ctx); * copy_from_user_sec_ctx(), convert to xfrm_user_sec_ctx * ... It seems that the expected parsing result for XFRMA_SEC_CTX should be structure xfrm_user_sec_ctx, and the current xfrm_sec_ctx is confusing and misleading (Luckily, they happen to have same size 8 bytes). This commit amend the policy structure to xfrm_user_sec_ctx to avoid ambiguity. Fixes: cf5cb79 ("[XFRM] netlink: Establish an attribute policy") Signed-off-by: Lin Ma <[email protected]> Signed-off-by: Steffen Klassert <[email protected]>
1 parent 75065a8 commit d1e0e61

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

net/xfrm/xfrm_compat.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ static const struct nla_policy compat_policy[XFRMA_MAX+1] = {
108108
[XFRMA_ALG_COMP] = { .len = sizeof(struct xfrm_algo) },
109109
[XFRMA_ENCAP] = { .len = sizeof(struct xfrm_encap_tmpl) },
110110
[XFRMA_TMPL] = { .len = sizeof(struct xfrm_user_tmpl) },
111-
[XFRMA_SEC_CTX] = { .len = sizeof(struct xfrm_sec_ctx) },
111+
[XFRMA_SEC_CTX] = { .len = sizeof(struct xfrm_user_sec_ctx) },
112112
[XFRMA_LTIME_VAL] = { .len = sizeof(struct xfrm_lifetime_cur) },
113113
[XFRMA_REPLAY_VAL] = { .len = sizeof(struct xfrm_replay_state) },
114114
[XFRMA_REPLAY_THRESH] = { .type = NLA_U32 },

net/xfrm/xfrm_user.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3024,7 +3024,7 @@ const struct nla_policy xfrma_policy[XFRMA_MAX+1] = {
30243024
[XFRMA_ALG_COMP] = { .len = sizeof(struct xfrm_algo) },
30253025
[XFRMA_ENCAP] = { .len = sizeof(struct xfrm_encap_tmpl) },
30263026
[XFRMA_TMPL] = { .len = sizeof(struct xfrm_user_tmpl) },
3027-
[XFRMA_SEC_CTX] = { .len = sizeof(struct xfrm_sec_ctx) },
3027+
[XFRMA_SEC_CTX] = { .len = sizeof(struct xfrm_user_sec_ctx) },
30283028
[XFRMA_LTIME_VAL] = { .len = sizeof(struct xfrm_lifetime_cur) },
30293029
[XFRMA_REPLAY_VAL] = { .len = sizeof(struct xfrm_replay_state) },
30303030
[XFRMA_REPLAY_THRESH] = { .type = NLA_U32 },

0 commit comments

Comments
 (0)