summaryrefslogtreecommitdiff
path: root/net/bridge
diff options
context:
space:
mode:
authorGao Feng <gfree.wind@vip.163.com>2017-05-16 04:30:18 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-10-13 10:09:32 +0300
commitab94214d643ed15ea0737db9c04c9c223201f346 (patch)
treea7476c54164b064c2c811b0c7e1399e31aff16e2 /net/bridge
parent72c6877269634ae6c70112c34c5961e6dd520799 (diff)
downloadlinux-ab94214d643ed15ea0737db9c04c9c223201f346.tar.xz
ebtables: arpreply: Add the standard target sanity check
commit c953d63548207a085abcb12a15fefc8a11ffdf0a upstream. The info->target comes from userspace and it would be used directly. So we need to add the sanity check to make sure it is a valid standard target, although the ebtables tool has already checked it. Kernel needs to validate anything coming from userspace. If the target is set as an evil value, it would break the ebtables and cause a panic. Because the non-standard target is treated as one offset. Now add one helper function ebt_invalid_target, and we would replace the macro INVALID_TARGET later. Signed-off-by: Gao Feng <gfree.wind@vip.163.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> Cc: Loic <hackurx@opensec.fr> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net/bridge')
-rw-r--r--net/bridge/netfilter/ebt_arpreply.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/net/bridge/netfilter/ebt_arpreply.c b/net/bridge/netfilter/ebt_arpreply.c
index 070cf134a22f..f2660c1b29e4 100644
--- a/net/bridge/netfilter/ebt_arpreply.c
+++ b/net/bridge/netfilter/ebt_arpreply.c
@@ -67,6 +67,9 @@ static int ebt_arpreply_tg_check(const struct xt_tgchk_param *par)
if (e->ethproto != htons(ETH_P_ARP) ||
e->invflags & EBT_IPROTO)
return -EINVAL;
+ if (ebt_invalid_target(info->target))
+ return -EINVAL;
+
return 0;
}