All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next 0/2] Minor cls_basic, act_bpf update
@ 2015-01-22  9:58 Daniel Borkmann
  2015-01-22  9:58 ` [PATCH net-next 1/2] net: cls_basic: return from walking on match in basic_get Daniel Borkmann
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Daniel Borkmann @ 2015-01-22  9:58 UTC (permalink / raw)
  To: davem; +Cc: jiri, netdev

Daniel Borkmann (2):
  net: cls_basic: return from walking on match in basic_get
  net: act_bpf: fix size mismatch on filter preparation

 net/sched/act_bpf.c   | 3 +++
 net/sched/cls_basic.c | 7 +++++--
 2 files changed, 8 insertions(+), 2 deletions(-)

-- 
1.7.11.7

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

* [PATCH net-next 1/2] net: cls_basic: return from walking on match in basic_get
  2015-01-22  9:58 [PATCH net-next 0/2] Minor cls_basic, act_bpf update Daniel Borkmann
@ 2015-01-22  9:58 ` Daniel Borkmann
  2015-01-22 10:01   ` Thomas Graf
  2015-01-22  9:58 ` [PATCH net-next 2/2] net: act_bpf: fix size mismatch on filter preparation Daniel Borkmann
  2015-01-27  0:09 ` [PATCH net-next 0/2] Minor cls_basic, act_bpf update David Miller
  2 siblings, 1 reply; 6+ messages in thread
From: Daniel Borkmann @ 2015-01-22  9:58 UTC (permalink / raw)
  To: davem; +Cc: jiri, netdev, Thomas Graf

As soon as we've found a matching handle in basic_get(), we can
return it. There's no need to continue walking until the end of
a filter chain, since they are unique anyway.

Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Acked-by: Jiri Pirko <jiri@resnulli.us>
Cc: Thomas Graf <tgraf@suug.ch>
---
 net/sched/cls_basic.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/net/sched/cls_basic.c b/net/sched/cls_basic.c
index 5aed341..fc399db 100644
--- a/net/sched/cls_basic.c
+++ b/net/sched/cls_basic.c
@@ -65,9 +65,12 @@ static unsigned long basic_get(struct tcf_proto *tp, u32 handle)
 	if (head == NULL)
 		return 0UL;
 
-	list_for_each_entry(f, &head->flist, link)
-		if (f->handle == handle)
+	list_for_each_entry(f, &head->flist, link) {
+		if (f->handle == handle) {
 			l = (unsigned long) f;
+			break;
+		}
+	}
 
 	return l;
 }
-- 
1.7.11.7

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

* [PATCH net-next 2/2] net: act_bpf: fix size mismatch on filter preparation
  2015-01-22  9:58 [PATCH net-next 0/2] Minor cls_basic, act_bpf update Daniel Borkmann
  2015-01-22  9:58 ` [PATCH net-next 1/2] net: cls_basic: return from walking on match in basic_get Daniel Borkmann
@ 2015-01-22  9:58 ` Daniel Borkmann
  2015-01-22 16:44   ` Alexei Starovoitov
  2015-01-27  0:09 ` [PATCH net-next 0/2] Minor cls_basic, act_bpf update David Miller
  2 siblings, 1 reply; 6+ messages in thread
From: Daniel Borkmann @ 2015-01-22  9:58 UTC (permalink / raw)
  To: davem; +Cc: jiri, netdev

Similarly as in cls_bpf, also this code needs to reject mismatches.

Reference: http://article.gmane.org/gmane.linux.network/347406
Fixes: d23b8ad8ab23 ("tc: add BPF based action")
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Acked-by: Jiri Pirko <jiri@resnulli.us>
---
 net/sched/act_bpf.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/sched/act_bpf.c b/net/sched/act_bpf.c
index 1bd257e..82c5d7f 100644
--- a/net/sched/act_bpf.c
+++ b/net/sched/act_bpf.c
@@ -122,6 +122,9 @@ static int tcf_bpf_init(struct net *net, struct nlattr *nla,
 		return -EINVAL;
 
 	bpf_size = bpf_num_ops * sizeof(*bpf_ops);
+	if (bpf_size != nla_len(tb[TCA_ACT_BPF_OPS]))
+		return -EINVAL;
+
 	bpf_ops = kzalloc(bpf_size, GFP_KERNEL);
 	if (!bpf_ops)
 		return -ENOMEM;
-- 
1.7.11.7

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

* Re: [PATCH net-next 1/2] net: cls_basic: return from walking on match in basic_get
  2015-01-22  9:58 ` [PATCH net-next 1/2] net: cls_basic: return from walking on match in basic_get Daniel Borkmann
@ 2015-01-22 10:01   ` Thomas Graf
  0 siblings, 0 replies; 6+ messages in thread
From: Thomas Graf @ 2015-01-22 10:01 UTC (permalink / raw)
  To: Daniel Borkmann; +Cc: davem, jiri, netdev

On 01/22/15 at 10:58am, Daniel Borkmann wrote:
> As soon as we've found a matching handle in basic_get(), we can
> return it. There's no need to continue walking until the end of
> a filter chain, since they are unique anyway.
> 
> Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
> Acked-by: Jiri Pirko <jiri@resnulli.us>
> Cc: Thomas Graf <tgraf@suug.ch>

Acked-by: Thomas Graf <tgraf@suug.ch>

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

* Re: [PATCH net-next 2/2] net: act_bpf: fix size mismatch on filter preparation
  2015-01-22  9:58 ` [PATCH net-next 2/2] net: act_bpf: fix size mismatch on filter preparation Daniel Borkmann
@ 2015-01-22 16:44   ` Alexei Starovoitov
  0 siblings, 0 replies; 6+ messages in thread
From: Alexei Starovoitov @ 2015-01-22 16:44 UTC (permalink / raw)
  To: Daniel Borkmann; +Cc: David S. Miller, Jiří Pírko, netdev

On Thu, Jan 22, 2015 at 1:58 AM, Daniel Borkmann <dborkman@redhat.com> wrote:
> Similarly as in cls_bpf, also this code needs to reject mismatches.
>
> Reference: http://article.gmane.org/gmane.linux.network/347406
> Fixes: d23b8ad8ab23 ("tc: add BPF based action")
> Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
> Acked-by: Jiri Pirko <jiri@resnulli.us>

Acked-by: Alexei Starovoitov <ast@plumgrid.com>

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

* Re: [PATCH net-next 0/2] Minor cls_basic, act_bpf update
  2015-01-22  9:58 [PATCH net-next 0/2] Minor cls_basic, act_bpf update Daniel Borkmann
  2015-01-22  9:58 ` [PATCH net-next 1/2] net: cls_basic: return from walking on match in basic_get Daniel Borkmann
  2015-01-22  9:58 ` [PATCH net-next 2/2] net: act_bpf: fix size mismatch on filter preparation Daniel Borkmann
@ 2015-01-27  0:09 ` David Miller
  2 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2015-01-27  0:09 UTC (permalink / raw)
  To: dborkman; +Cc: jiri, netdev

From: Daniel Borkmann <dborkman@redhat.com>
Date: Thu, 22 Jan 2015 10:58:17 +0100

> Daniel Borkmann (2):
>   net: cls_basic: return from walking on match in basic_get
>   net: act_bpf: fix size mismatch on filter preparation

Seires applied, thanks.

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

end of thread, other threads:[~2015-01-27  0:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-22  9:58 [PATCH net-next 0/2] Minor cls_basic, act_bpf update Daniel Borkmann
2015-01-22  9:58 ` [PATCH net-next 1/2] net: cls_basic: return from walking on match in basic_get Daniel Borkmann
2015-01-22 10:01   ` Thomas Graf
2015-01-22  9:58 ` [PATCH net-next 2/2] net: act_bpf: fix size mismatch on filter preparation Daniel Borkmann
2015-01-22 16:44   ` Alexei Starovoitov
2015-01-27  0:09 ` [PATCH net-next 0/2] Minor cls_basic, act_bpf update David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.