Skip to content

Commit

Permalink
netfilter: xt_owner: bail out with EINVAL in case of unsupported flags
Browse files Browse the repository at this point in the history
Reject flags that are not supported with EINVAL.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
  • Loading branch information
Pablo Neira Ayuso committed Jun 17, 2019
1 parent 87e389b commit 9911c11
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions include/uapi/linux/netfilter/xt_owner.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 3 additions & 0 deletions net/netfilter/xt_owner.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down

0 comments on commit 9911c11

Please sign in to comment.