diff options
author | Rahul Dadhich <r.dadhich@samsung.com> | 2019-08-28 18:38:56 +0530 |
---|---|---|
committer | Rahul Dadhich <r.dadhich@samsung.com> | 2019-09-10 12:04:28 +0000 |
commit | 502a4051338efbcd18a35e0b6100df510f02f248 (patch) | |
tree | 023a3505041e5d243ca514c7d89fc6f87d968b19 | |
parent | 8c7fcbc63c7dab79597aa23eceb33807d7ec8a1a (diff) | |
download | emulator-kernel-502a4051338efbcd18a35e0b6100df510f02f248.tar.gz emulator-kernel-502a4051338efbcd18a35e0b6100df510f02f248.tar.bz2 emulator-kernel-502a4051338efbcd18a35e0b6100df510f02f248.zip |
netfilter: xt_owner: bail out with EINVAL in case of unsupported flags
Change-Id: Ic83f49e526d564977622f69ff907fb6d928dc161
Signed-off-by: Rahul Dadhich <r.dadhich@samsung.com>
(cherry picked from commit 97424c551a9eb8f44806da4fa6f7441c88c41f01)
-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 2081761714b5..7fcac2e5b33e 100644 --- a/include/uapi/linux/netfilter/xt_owner.h +++ b/include/uapi/linux/netfilter/xt_owner.h @@ -9,6 +9,11 @@ enum { XT_OWNER_SOCKET = 1 << 2, }; +#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 1302b475abcb..127823fa8bae 100644 --- a/net/netfilter/xt_owner.c +++ b/net/netfilter/xt_owner.c @@ -22,6 +22,9 @@ static int owner_check(const struct xt_mtchk_param *par) { struct xt_owner_match_info *info = par->matchinfo; + if (info->match & ~XT_OWNER_MASK) + return -EINVAL; + /* For now only allow adding matches from the initial user namespace */ if ((info->match & (XT_OWNER_UID|XT_OWNER_GID)) && (current_user_ns() != &init_user_ns)) |