mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
xfrm: Add dir validation to "in" data path lookup
Introduces validation for the x->dir attribute within the XFRM input data lookup path. If the configured direction does not match the expected direction, input, increment the XfrmInStateDirError counter and drop the packet to ensure data integrity and correct flow handling. grep -vw 0 /proc/net/xfrm_stat XfrmInStateDirError 1 Signed-off-by: Antony Antony <antony.antony@secunet.com> Reviewed-by: Sabrina Dubroca <sd@queasysnail.net> Reviewed-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
This commit is contained in:
committed by
Steffen Klassert
parent
601a0867f8
commit
304b44f0d5
@@ -266,6 +266,13 @@ int xfrm6_input_addr(struct sk_buff *skb, xfrm_address_t *daddr,
|
||||
if (!x)
|
||||
continue;
|
||||
|
||||
if (unlikely(x->dir && x->dir != XFRM_SA_DIR_IN)) {
|
||||
XFRM_INC_STATS(net, LINUX_MIB_XFRMINSTATEDIRERROR);
|
||||
xfrm_state_put(x);
|
||||
x = NULL;
|
||||
continue;
|
||||
}
|
||||
|
||||
spin_lock(&x->lock);
|
||||
|
||||
if ((!i || (x->props.flags & XFRM_STATE_WILDRECV)) &&
|
||||
|
||||
Reference in New Issue
Block a user