diff mbox

[nf] netfilter: nfnetlink_acct: validate NFACCT_QUOTA parameter

Message ID 1462307959-3553-1-git-send-email-phil.turnbull@oracle.com
State Accepted
Delegated to: Pablo Neira
Headers show

Commit Message

phil.turnbull@oracle.com May 3, 2016, 8:39 p.m. UTC
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>
---
 net/netfilter/nfnetlink_acct.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Pablo Neira Ayuso May 5, 2016, 1:43 p.m. UTC | #1
On Tue, May 03, 2016 at 04:39:19PM -0400, Phil Turnbull wrote:
> 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.

Applied, thanks.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/netfilter/nfnetlink_acct.c b/net/netfilter/nfnetlink_acct.c
index 4c2b4c0..dbd0803 100644
--- a/net/netfilter/nfnetlink_acct.c
+++ b/net/netfilter/nfnetlink_acct.c
@@ -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);
 	}