DPDK patches and discussions
 help / color / mirror / Atom feed
From: Hyong Youb Kim <hyonkim@cisco.com>
To: Ferruh Yigit <ferruh.yigit@intel.com>
Cc: dev@dpdk.org, John Daley <johndale@cisco.com>,
	Hyong Youb Kim <hyonkim@cisco.com>
Subject: [dpdk-dev] [PATCH] net/enic: fix raw item length check
Date: Mon,  8 Apr 2019 23:40:26 -0700	[thread overview]
Message-ID: <20190409064026.13646-1-hyonkim@cisco.com> (raw)
Message-ID: <20190409064026.t07o-J7LT9QqEEDjtYQqGuV7_q6Ni6o1TlbT3smhWVI@z> (raw)

Currently, the raw item is always preceeded by a UDP header, and both
land in the L4 pattern buffer. So consider the UDP header size when
checking if the raw spec fits in the L4 buffer.

Coverity issue: 336796
Coverity issue: 336850
Fixes: 477959e6eeb0 ("net/enic: enable limited support for raw flow item")

Signed-off-by: Hyong Youb Kim <hyonkim@cisco.com>
Reviewed-by: John Daley <johndale@cisco.com>
---
 drivers/net/enic/enic_flow.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/enic/enic_flow.c b/drivers/net/enic/enic_flow.c
index 5924a01e3..32ebeff09 100644
--- a/drivers/net/enic/enic_flow.c
+++ b/drivers/net/enic/enic_flow.c
@@ -967,7 +967,8 @@ enic_copy_item_raw_v2(struct copy_item_args *arg)
 	if (!spec->relative || spec->offset != 0 || spec->search || spec->limit)
 		return EINVAL;
 	/* Need non-null pattern that fits within the NIC's filter pattern */
-	if (spec->length == 0 || spec->length > FILTER_GENERIC_1_KEY_LEN ||
+	if (spec->length == 0 ||
+	    spec->length + sizeof(struct udp_hdr) > FILTER_GENERIC_1_KEY_LEN ||
 	    !spec->pattern || !mask->pattern)
 		return EINVAL;
 	/*
-- 
2.16.2


             reply	other threads:[~2019-04-09  6:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-09  6:40 Hyong Youb Kim [this message]
2019-04-09  6:40 ` Hyong Youb Kim
2019-04-11 16:44 ` Ferruh Yigit
2019-04-11 16:44   ` Ferruh Yigit

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=20190409064026.13646-1-hyonkim@cisco.com \
    --to=hyonkim@cisco.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=johndale@cisco.com \
    /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).