Patch "xfrm_user: uncoditionally validate esn replay attribute struct" has been added to the 3.18-stable tree
Subsystems (3)
This is a note to let you know that I've just added the patch titled
xfrm_user: uncoditionally validate esn replay attribute struct
to the 3.18-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:
xfrm_user-uncoditionally-validate-esn-replay-attribute-struct.patch
and it can be found in the queue-3.18 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
d97ca5d714a5334aecadadf696875da40f1fbf3eMon Sep 17 00:00:00 2001
From: Florian Westphal <[email protected]>
Date: Mon, 12 Feb 2018 14:42:01 +0100
Subject: xfrm_user: uncoditionally validate esn replay attribute struct
From: Florian Westphal <[email protected]>
commit d97ca5d714a5334aecadadf696875da40f1fbf3e upstream.
The sanity test added in ecd7918745234 can be bypassed, validation only occurs if XFRM_STATE_ESN flag is set, but rest of code doesn't care and just checks if the attribute itself is present.
So always validate. Alternative is to reject if we have the attribute without the flag but that would change abi.
--- net/xfrm/xfrm_user.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-)
net/xfrm/xfrm_user.c +8 -13
@@ -120,22 +120,17 @@ static inline int verify_replay(struct xstruct nlattr *rt = attrs[XFRMA_REPLAY_ESN_VAL ];struct xfrm_replay_state_esn *rs; -if (p->flags &XFRM_STATE_ESN ) { -if (!rt) -return -EINVAL ; - - rs =nla_data (rt); +if (!rt) +return (p->flags &XFRM_STATE_ESN ) ? -EINVAL :0 ; -if (rs->bmp_len >XFRMA_REPLAY_ESN_MAX /sizeof (rs->bmp[0 ]) /8 ) -return -EINVAL ; + rs =nla_data (rt); -if (nla_len (rt) <xfrm_replay_state_esn_len (rs) && -nla_len (rt) !=sizeof (*rs)) -return -EINVAL ; - } +if (rs->bmp_len >XFRMA_REPLAY_ESN_MAX /sizeof (rs->bmp[0 ]) /8 ) +return -EINVAL ; -if (!rt) -return 0 ; +if (nla_len (rt) <xfrm_replay_state_esn_len (rs) && +nla_len (rt) !=sizeof (*rs)) +return -EINVAL ;/* As only ESP and AH support ESN feature. */ if ((p->id.proto !=IPPROTO_ESP ) && (p->id.proto !=IPPROTO_AH ))
Patches currently in stable-queue which might be from [email protected] are
queue-3.18/xfrm_user-uncoditionally-validate-esn-replay-attribute-struct.patch