提交 c907ef53 编写于 作者: T Taehee Yoo 提交者: Xie XiuQi

netfilter: xt_TEE: add missing code to get interface index in checkentry.

mainline inclusion
from mainline-4.20
commit 18c0ab87
category: bugfix
bugzilla: 6233
CVE: NA

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

checkentry(tee_tg_check) should initialize priv->oif from dev if possible.
But only netdevice notifier handler can set that.
Hence priv->oif is always -1 until notifier handler is called.

Fixes: 9e2f6c5d ("netfilter: Rework xt_TEE netdevice notifier")
Signed-off-by: NTaehee Yoo <ap420073@gmail.com>
Signed-off-by: NPablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: NMao Wenan <maowenan@huawei.com>
Reviewed-by: NWei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 088b32c8
......@@ -95,6 +95,8 @@ static int tee_tg_check(const struct xt_tgchk_param *par)
return -EINVAL;
if (info->oif[0]) {
struct net_device *dev;
if (info->oif[sizeof(info->oif)-1] != '\0')
return -EINVAL;
......@@ -106,6 +108,11 @@ static int tee_tg_check(const struct xt_tgchk_param *par)
priv->oif = -1;
info->priv = priv;
dev = dev_get_by_name(par->net, info->oif);
if (dev) {
priv->oif = dev->ifindex;
dev_put(dev);
}
mutex_lock(&priv_list_mutex);
list_add(&priv->list, &priv_list);
mutex_unlock(&priv_list_mutex);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册