提交 515ae62b 编写于 作者: A Antony Antony 提交者: Zheng Zengkai

xfrm: fix the if_id check in changelink

stable inclusion
from stable-v5.10.104
commit 2f0e6d80e8b570aeb7e6eb6db2e2dd9fdbb6236c
bugzilla: https://gitee.com/openeuler/kernel/issues/I56XAC

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=2f0e6d80e8b570aeb7e6eb6db2e2dd9fdbb6236c

--------------------------------

commit 6d0d95a1 upstream.

if_id will be always 0, because it was not yet initialized.

Fixes: 8dce4391 ("xfrm: interface with if_id 0 should return error")
Reported-by: NPavel Machek <pavel@denx.de>
Signed-off-by: NAntony Antony <antony.antony@secunet.com>
Signed-off-by: NSteffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NYu Liao <liaoyu15@huawei.com>
Reviewed-by: NWei Li <liwei391@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 ddba53f0
......@@ -679,12 +679,12 @@ static int xfrmi_changelink(struct net_device *dev, struct nlattr *tb[],
struct net *net = xi->net;
struct xfrm_if_parms p = {};
xfrmi_netlink_parms(data, &p);
if (!p.if_id) {
NL_SET_ERR_MSG(extack, "if_id must be non zero");
return -EINVAL;
}
xfrmi_netlink_parms(data, &p);
xi = xfrmi_locate(net, &p);
if (!xi) {
xi = netdev_priv(dev);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册