浏览代码

af_key: mark policy as dead before destroying

xfrm_policy_destroy() will oops if not dead policy is passed to it.
On error path in pfkey_compile_policy() exactly this happens.

Oopsable for CAP_NET_ADMIN owners.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Alexey Dobriyan 16 年之前
父节点
当前提交
70e90679ff
共有 1 个文件被更改,包括 1 次插入0 次删除
  1. 1 0
      net/key/af_key.c

+ 1 - 0
net/key/af_key.c

@@ -3188,6 +3188,7 @@ static struct xfrm_policy *pfkey_compile_policy(struct sock *sk, int opt,
 	return xp;
 
 out:
+	xp->walk.dead = 1;
 	xfrm_policy_destroy(xp);
 	return NULL;
 }