netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Borkmann <dborkman@redhat.com>
To: davem@davemloft.net
Cc: jiri@resnulli.us, netdev@vger.kernel.org
Subject: [PATCH net-next 2/2] net: act_bpf: fix size mismatch on filter preparation
Date: Thu, 22 Jan 2015 10:58:19 +0100	[thread overview]
Message-ID: <1421920699-26556-3-git-send-email-dborkman@redhat.com> (raw)
In-Reply-To: <1421920699-26556-1-git-send-email-dborkman@redhat.com>

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

  parent reply	other threads:[~2015-01-22  9:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` Daniel Borkmann [this message]
2015-01-22 16:44   ` [PATCH net-next 2/2] net: act_bpf: fix size mismatch on filter preparation Alexei Starovoitov
2015-01-27  0:09 ` [PATCH net-next 0/2] Minor cls_basic, act_bpf update David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1421920699-26556-3-git-send-email-dborkman@redhat.com \
    --to=dborkman@redhat.com \
    --cc=davem@davemloft.net \
    --cc=jiri@resnulli.us \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).