[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1419819455-19109-1-git-send-email-simon.horman@netronome.com>
Date: Mon, 29 Dec 2014 11:17:35 +0900
From: Simon Horman <simon.horman@...ronome.com>
To: John Fastabend <john.r.fastabend@...el.com>, netdev@...r.kernel.org
Cc: Simon Horman <simon.horman@...ronome.com>
Subject: [PATCH] net: flow: Guard against accessing non-existent attributes
Signed-off-by: Simon Horman <simon.horman@...ronome.com>
---
net/core/flow_table.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/net/core/flow_table.c b/net/core/flow_table.c
index 5937fb7..df2adf6 100644
--- a/net/core/flow_table.c
+++ b/net/core/flow_table.c
@@ -480,6 +480,10 @@ static int net_flow_get_action(struct net_flow_action *a, struct nlattr *attr)
if (err < 0)
return err;
+ if (!act[NET_FLOW_ACTION_ATTR_UID] ||
+ !act[NET_FLOW_ACTION_ATTR_SIGNATURE])
+ return -EINVAL;
+
a->uid = nla_get_u32(act[NET_FLOW_ACTION_ATTR_UID]);
nla_for_each_nested(args, act[NET_FLOW_ACTION_ATTR_SIGNATURE], rem)
@@ -513,6 +517,10 @@ static int net_flow_get_flow(struct net_flow_flow *flow, struct nlattr *attr)
if (err < 0)
return -EINVAL;
+ if (!f[NET_FLOW_ATTR_TABLE] || !f[NET_FLOW_ATTR_UID] ||
+ !f[NET_FLOW_ATTR_PRIORITY])
+ return -EINVAL;
+
flow->table_id = nla_get_u32(f[NET_FLOW_ATTR_TABLE]);
flow->uid = nla_get_u32(f[NET_FLOW_ATTR_UID]);
flow->priority = nla_get_u32(f[NET_FLOW_ATTR_PRIORITY]);
@@ -1209,6 +1217,9 @@ static int net_flow_table_cmd_get_flows(struct sk_buff *skb,
if (err)
goto out;
+ if (!tb[NET_FLOW_TABLE_FLOWS_TABLE])
+ goto out;
+
table = nla_get_u32(tb[NET_FLOW_TABLE_FLOWS_TABLE]);
if (tb[NET_FLOW_TABLE_FLOWS_MINPRIO])
--
2.1.3
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists