diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2019-06-07 16:37:30 +0200 |
---|---|---|
committer | Seung-Woo Kim <sw0312.kim@samsung.com> | 2019-07-04 12:43:30 +0000 |
commit | 9cb6b56a469925b658703b8d238334d1e91ea7bf (patch) | |
tree | 91dcbd6b42aa45f2130398189d8b08fa7d51fe20 | |
parent | 11e73f751371dc2a2b3a9e9a8d3bf568d0ba7adb (diff) | |
download | linux-rpi3-accepted/tizen/unified/20190705.110629.tar.gz linux-rpi3-accepted/tizen/unified/20190705.110629.tar.bz2 linux-rpi3-accepted/tizen/unified/20190705.110629.zip |
netfilter: xt_owner: bail out with EINVAL in case of unsupported flagssubmit/tizen/20190705.061049accepted/tizen/unified/20190705.110629
Reject flags that are not supported with EINVAL.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
[sw0312.kim: backport from mainline to apply supplementary groups on netfilter]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: Id867ca48290a8e6627ad7d1b1f159669fc5c44a1
-rw-r--r-- | include/uapi/linux/netfilter/xt_owner.h | 5 | ||||
-rw-r--r-- | net/netfilter/xt_owner.c | 3 |
2 files changed, 8 insertions, 0 deletions
diff --git a/include/uapi/linux/netfilter/xt_owner.h b/include/uapi/linux/netfilter/xt_owner.h index 9e98c09eda32..5108df4d0313 100644 --- a/include/uapi/linux/netfilter/xt_owner.h +++ b/include/uapi/linux/netfilter/xt_owner.h @@ -11,6 +11,11 @@ enum { XT_OWNER_SUPPL_GROUPS = 1 << 3, }; +#define XT_OWNER_MASK (XT_OWNER_UID | \ + XT_OWNER_GID | \ + XT_OWNER_SOCKET | \ + XT_OWNER_SUPPL_GROUPS) + struct xt_owner_match_info { __u32 uid_min, uid_max; __u32 gid_min, gid_max; diff --git a/net/netfilter/xt_owner.c b/net/netfilter/xt_owner.c index a8784502aca6..ee597fdc5db7 100644 --- a/net/netfilter/xt_owner.c +++ b/net/netfilter/xt_owner.c @@ -25,6 +25,9 @@ static int owner_check(const struct xt_mtchk_param *par) struct xt_owner_match_info *info = par->matchinfo; struct net *net = par->net; + if (info->match & ~XT_OWNER_MASK) + return -EINVAL; + /* Only allow the common case where the userns of the writer * matches the userns of the network namespace. */ |