netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: flow: Guard against accessing non-existent attributes
@ 2014-12-29  2:17 Simon Horman
  2014-12-29 17:53 ` John Fastabend
  0 siblings, 1 reply; 3+ messages in thread
From: Simon Horman @ 2014-12-29  2:17 UTC (permalink / raw)
  To: John Fastabend, netdev; +Cc: Simon Horman

Signed-off-by: Simon Horman <simon.horman@netronome.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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] net: flow: Guard against accessing non-existent attributes
  2014-12-29  2:17 [PATCH] net: flow: Guard against accessing non-existent attributes Simon Horman
@ 2014-12-29 17:53 ` John Fastabend
  2015-01-05  2:04   ` Simon Horman
  0 siblings, 1 reply; 3+ messages in thread
From: John Fastabend @ 2014-12-29 17:53 UTC (permalink / raw)
  To: Simon Horman; +Cc: John Fastabend, netdev

On 12/28/2014 06:17 PM, Simon Horman wrote:
> Signed-off-by: Simon Horman <simon.horman@netronome.com>
> ---
>   net/core/flow_table.c | 11 +++++++++++
>   1 file changed, 11 insertions(+)

Great thanks. I rolled it into the patches I should hopefully have
ready to submit later today.

By the way I got this working on rocker now so we can test it easier,
I'll post the driver updates as well.

.John

-- 
John Fastabend         Intel Corporation

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] net: flow: Guard against accessing non-existent attributes
  2014-12-29 17:53 ` John Fastabend
@ 2015-01-05  2:04   ` Simon Horman
  0 siblings, 0 replies; 3+ messages in thread
From: Simon Horman @ 2015-01-05  2:04 UTC (permalink / raw)
  To: John Fastabend; +Cc: John Fastabend, netdev

On Mon, Dec 29, 2014 at 09:53:30AM -0800, John Fastabend wrote:
> On 12/28/2014 06:17 PM, Simon Horman wrote:
> >Signed-off-by: Simon Horman <simon.horman@netronome.com>
> >---
> >  net/core/flow_table.c | 11 +++++++++++
> >  1 file changed, 11 insertions(+)
> 
> Great thanks. I rolled it into the patches I should hopefully have
> ready to submit later today.
> 
> By the way I got this working on rocker now so we can test it easier,
> I'll post the driver updates as well.

Great, excellent news.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-01-05  2:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-29  2:17 [PATCH] net: flow: Guard against accessing non-existent attributes Simon Horman
2014-12-29 17:53 ` John Fastabend
2015-01-05  2:04   ` Simon Horman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).