aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTaehee Yoo <ap420073@gmail.com>2018-10-07 00:09:32 +0900
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-03-13 14:02:40 -0700
commite6e00017910cadeace868ebe3bb6369accc486a4 (patch)
tree6821c2b2252a997e10c618ea96658ad0b2ce34fd
parent02d86085cac6365ecf68a124ac05fbe1acb60377 (diff)
downloadlinux-yocto-e6e00017910cadeace868ebe3bb6369accc486a4.tar.gz
linux-yocto-e6e00017910cadeace868ebe3bb6369accc486a4.tar.bz2
linux-yocto-e6e00017910cadeace868ebe3bb6369accc486a4.zip
netfilter: xt_TEE: add missing code to get interface index in checkentry.
[ Upstream commit 18c0ab87364ac5128a152055fdcb1d27e01caf01 ] 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: 9e2f6c5d78db ("netfilter: Rework xt_TEE netdevice notifier") Signed-off-by: Taehee Yoo <ap420073@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--net/netfilter/xt_TEE.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/net/netfilter/xt_TEE.c b/net/netfilter/xt_TEE.c
index 673ad2099f97..1dae02a97ee3 100644
--- a/net/netfilter/xt_TEE.c
+++ b/net/netfilter/xt_TEE.c
@@ -104,6 +104,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;
@@ -115,6 +117,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(&tn->lock);
list_add(&priv->list, &tn->priv_list);
mutex_unlock(&tn->lock);