mirror of
https://github.com/torvalds/linux.git
synced 2026-11-06 21:58:01 +01:00
xfrm: policy: reject mark with bits outside its mask on add
Same issue as states: an invalid mark/mask is silently truncated on
insert, so GETPOLICY and DELPOLICY can no longer find the policy by
id. Reject it instead.
The mark is no longer sanitized on policy insert.
Fixes: 0b91fda3a1 ("xfrm: Sanitize marks before insert")
Cc: <stable+noautosel@kernel.org> # avoid breaking existing userspace ABI
Signed-off-by: Antony Antony <antony.antony@secunet.com>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
This commit is contained in:
parent
07d7b25224
commit
b3056e57b0
|
|
@ -1575,9 +1575,6 @@ int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl)
|
|||
struct xfrm_policy *delpol;
|
||||
struct hlist_head *chain;
|
||||
|
||||
/* Sanitize mark before store */
|
||||
policy->mark.v &= policy->mark.m;
|
||||
|
||||
spin_lock_bh(&net->xfrm.xfrm_policy_lock);
|
||||
chain = policy_hash_bysel(net, &policy->selector, policy->family, dir);
|
||||
if (chain)
|
||||
|
|
|
|||
|
|
@ -2307,6 +2307,9 @@ static int xfrm_add_policy(struct sk_buff *skb, struct nlmsghdr *nlh,
|
|||
if (err)
|
||||
return err;
|
||||
err = verify_sec_ctx_len(attrs, extack);
|
||||
if (err)
|
||||
return err;
|
||||
err = verify_mark(attrs, extack);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user