diff mbox

[nf] netfilter: nf_tables: validate NFTA_SET_TABLE parameter

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

Commit Message

phil.turnbull@oracle.com May 27, 2016, 5:34 p.m. UTC
If the NFTA_SET_TABLE parameter is missing and the NLM_F_DUMP flag is
not set, then a NULL pointer dereference is triggered in
nf_tables_set_lookup because ctx.table is NULL.

Signed-off-by: Phil Turnbull <phil.turnbull@oracle.com>
---
 net/netfilter/nf_tables_api.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Pablo Neira Ayuso May 30, 2016, 9:33 a.m. UTC | #1
On Fri, May 27, 2016 at 01:34:04PM -0400, Phil Turnbull wrote:
> If the NFTA_SET_TABLE parameter is missing and the NLM_F_DUMP flag is
> not set, then a NULL pointer dereference is triggered in
> nf_tables_set_lookup because ctx.table is NULL.

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/nf_tables_api.c b/net/netfilter/nf_tables_api.c
index c444929..569ba6a 100644
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -2647,6 +2647,8 @@  static int nf_tables_getset(struct net *net, struct sock *nlsk,
 	/* Only accept unspec with dump */
 	if (nfmsg->nfgen_family == NFPROTO_UNSPEC)
 		return -EAFNOSUPPORT;
+	if (!nla[NFTA_SET_TABLE])
+		return -EINVAL;
 
 	set = nf_tables_set_lookup(ctx.table, nla[NFTA_SET_NAME]);
 	if (IS_ERR(set))