Patchwork [nfnetlink_acct,v2,1/2] nfnl_acct_new: add packet/byte values check

login
register
mail settings
Submitter Michael Zintakis
Date April 14, 2013, 9:53 a.m.
Message ID <516A7CA3.1020206@googlemail.com>
Download mbox | patch
Permalink /patch/236424/
State Not Applicable
Headers show

Comments

Michael Zintakis - April 14, 2013, 9:53 a.m.
* check that in nfnetlink_acct.c::nfnl_acct_new both packet and byte
  values are specified and return EINVAL if that is not the case

Signed-off-by: Michael Zintakis <michael.zintakis@googlemail.com>
---
 net/netfilter/nfnetlink_acct.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)


--
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

Patch

diff --git a/net/netfilter/nfnetlink_acct.c b/net/netfilter/nfnetlink_acct.c
index dc3fd5d..c8d1282 100644
--- a/net/netfilter/nfnetlink_acct.c
+++ b/net/netfilter/nfnetlink_acct.c
@@ -45,7 +45,9 @@  nfnl_acct_new(struct sock *nfnl, struct sk_buff *skb,
 	struct nf_acct *nfacct, *matching = NULL;
 	char *acct_name;
 
-	if (!tb[NFACCT_NAME])
+	if (!tb[NFACCT_NAME] ||
+	    (tb[NFACCT_BYTES] && !tb[NFACCT_PKTS]) ||
+	    (!tb[NFACCT_BYTES] && tb[NFACCT_PKTS]))
 		return -EINVAL;
 
 	acct_name = nla_data(tb[NFACCT_NAME]);