netfilter: nfnetlink_acct: validate NFACCT_QUOTA parameter
authorPhil Turnbull <phil.turnbull@oracle.com>
Tue, 3 May 2016 20:39:19 +0000 (16:39 -0400)
committerPablo Neira Ayuso <pablo@netfilter.org>
Thu, 5 May 2016 14:47:08 +0000 (16:47 +0200)
If a quota bit is set in NFACCT_FLAGS but the NFACCT_QUOTA parameter is
missing then a NULL pointer dereference is triggered. CAP_NET_ADMIN is
required to trigger the bug.

Signed-off-by: Phil Turnbull <phil.turnbull@oracle.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/nfnetlink_acct.c

index 4c2b4c0c4d5fa4ac209ab85020e97e14ed716ab9..dbd0803b18273bbf3b37e7f0f5bfae87d5acfc2d 100644 (file)
@@ -96,6 +96,8 @@ static int nfnl_acct_new(struct net *net, struct sock *nfnl,
                        return -EINVAL;
                if (flags & NFACCT_F_OVERQUOTA)
                        return -EINVAL;
+               if ((flags & NFACCT_F_QUOTA) && !tb[NFACCT_QUOTA])
+                       return -EINVAL;
 
                size += sizeof(u64);
        }