提交 48f486e1 编写于 作者: Y Yu Kuai 提交者: Steffen Klassert

net: xfrm: fix memory leak in xfrm_user_policy()

if xfrm_get_translator() failed, xfrm_user_policy() return without
freeing 'data', which is allocated in memdup_sockptr().

Fixes: 96392ee5 ("xfrm/compat: Translate 32-bit user_policy from sockptr")
Reported-by: NHulk Robot <hulkci@huawei.com>
Signed-off-by: NYu Kuai <yukuai3@huawei.com>
Signed-off-by: NSteffen Klassert <steffen.klassert@secunet.com>
上级 bc0230b6
......@@ -2382,8 +2382,10 @@ int xfrm_user_policy(struct sock *sk, int optname, sockptr_t optval, int optlen)
if (in_compat_syscall()) {
struct xfrm_translator *xtr = xfrm_get_translator();
if (!xtr)
if (!xtr) {
kfree(data);
return -EOPNOTSUPP;
}
err = xtr->xlate_user_policy_sockptr(&data, optlen);
xfrm_put_translator(xtr);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册