Patch "net: xfrm: Amend XFRMA_SEC_CTX nla_policy structure" has been added to the 6.4-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    net: xfrm: Amend XFRMA_SEC_CTX nla_policy structure

to the 6.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     net-xfrm-amend-xfrma_sec_ctx-nla_policy-structure.patch
and it can be found in the queue-6.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 8d33b3d3a3ce059f21519f10e86a7ce84d2b69e9
Author: Lin Ma <linma@xxxxxxxxxx>
Date:   Fri Jun 30 16:19:11 2023 +0800

    net: xfrm: Amend XFRMA_SEC_CTX nla_policy structure
    
    [ Upstream commit d1e0e61d617ba17aa516db707aa871387566bbf7 ]
    
    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: cf5cb79f6946 ("[XFRM] netlink: Establish an attribute policy")
    Signed-off-by: Lin Ma <linma@xxxxxxxxxx>
    Signed-off-by: Steffen Klassert <steffen.klassert@xxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/net/xfrm/xfrm_compat.c b/net/xfrm/xfrm_compat.c
index 8cbf45a8bcdc2..655fe4ff86212 100644
--- a/net/xfrm/xfrm_compat.c
+++ b/net/xfrm/xfrm_compat.c
@@ -108,7 +108,7 @@ static const struct nla_policy compat_policy[XFRMA_MAX+1] = {
 	[XFRMA_ALG_COMP]	= { .len = sizeof(struct xfrm_algo) },
 	[XFRMA_ENCAP]		= { .len = sizeof(struct xfrm_encap_tmpl) },
 	[XFRMA_TMPL]		= { .len = sizeof(struct xfrm_user_tmpl) },
-	[XFRMA_SEC_CTX]		= { .len = sizeof(struct xfrm_sec_ctx) },
+	[XFRMA_SEC_CTX]		= { .len = sizeof(struct xfrm_user_sec_ctx) },
 	[XFRMA_LTIME_VAL]	= { .len = sizeof(struct xfrm_lifetime_cur) },
 	[XFRMA_REPLAY_VAL]	= { .len = sizeof(struct xfrm_replay_state) },
 	[XFRMA_REPLAY_THRESH]	= { .type = NLA_U32 },
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index 7c91deadc36e5..fdc0c17122b69 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -3024,7 +3024,7 @@ const struct nla_policy xfrma_policy[XFRMA_MAX+1] = {
 	[XFRMA_ALG_COMP]	= { .len = sizeof(struct xfrm_algo) },
 	[XFRMA_ENCAP]		= { .len = sizeof(struct xfrm_encap_tmpl) },
 	[XFRMA_TMPL]		= { .len = sizeof(struct xfrm_user_tmpl) },
-	[XFRMA_SEC_CTX]		= { .len = sizeof(struct xfrm_sec_ctx) },
+	[XFRMA_SEC_CTX]		= { .len = sizeof(struct xfrm_user_sec_ctx) },
 	[XFRMA_LTIME_VAL]	= { .len = sizeof(struct xfrm_lifetime_cur) },
 	[XFRMA_REPLAY_VAL]	= { .len = sizeof(struct xfrm_replay_state) },
 	[XFRMA_REPLAY_THRESH]	= { .type = NLA_U32 },



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux