Skip to content

Commit

Permalink
netfilter: nfnetlink_acct: validate NFACCT_FILTER parameters
Browse files Browse the repository at this point in the history
nfacct_filter_alloc doesn't validate the NFACCT_FILTER_MASK and
NFACCT_FILTER_VALUE parameters which can trigger a NULL pointer
dereference. CAP_NET_ADMIN is required to trigger the bug.

Signed-off-by: Phil Turnbull <[email protected]>
Signed-off-by: Pablo Neira Ayuso <[email protected]>
  • Loading branch information
Phil Turnbull authored and ummakynes committed Feb 29, 2016
1 parent 472681d commit 017b1b6
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions net/netfilter/nfnetlink_acct.c
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,9 @@ nfacct_filter_alloc(const struct nlattr * const attr)
if (err < 0)
return ERR_PTR(err);

if (!tb[NFACCT_FILTER_MASK] || !tb[NFACCT_FILTER_VALUE])
return ERR_PTR(-EINVAL);

filter = kzalloc(sizeof(struct nfacct_filter), GFP_KERNEL);
if (!filter)
return ERR_PTR(-ENOMEM);
Expand Down

0 comments on commit 017b1b6

Please sign in to comment.