Skip to content

Commit

Permalink
xfrm_user: verify policy direction at XFRM_MSG_POLEXPIRE handler
Browse files Browse the repository at this point in the history
Add missing check for policy direction verification. This is
especially important since without this xfrm_user may end up
deleting per-socket policy which is not allowed.

Signed-off-by: Timo Teras <[email protected]>
Acked-by: Herbert Xu <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
fabled authored and davem330 committed Apr 2, 2010
1 parent 34996cb commit c8bf4d0
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions net/xfrm/xfrm_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -1741,6 +1741,10 @@ static int xfrm_add_pol_expire(struct sk_buff *skb, struct nlmsghdr *nlh,
if (err)
return err;

err = verify_policy_dir(p->dir);
if (err)
return err;

if (p->index)
xp = xfrm_policy_byid(net, mark, type, p->dir, p->index, 0, &err);
else {
Expand Down

0 comments on commit c8bf4d0

Please sign in to comment.