patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Ferruh Yigit <ferruh.yigit@intel.com>
To: Luca Boccassi <bluca@debian.org>,
	Haiyang Zhang <haiyangz@microsoft.com>,
	 Stephen Hemminger <sthemmin@microsoft.com>,
	Long Li <longli@microsoft.com>
Cc: dev@dpdk.org, Stephen Hemminger <stephen@networkplumber.org>,
	stable@dpdk.org
Subject: Re: [dpdk-stable] [dpdk-dev] [PATCH 4/4] net/netvsc: check for overflow on packet info from host
Date: Tue, 27 Oct 2020 23:07:23 +0000	[thread overview]
Message-ID: <6b38cad9-f02c-38c2-8abf-c1bd1a56422a@intel.com> (raw)
In-Reply-To: <448f5c5936625014871fe856318d515684930050.camel@debian.org>

On 10/27/2020 5:10 PM, Luca Boccassi wrote:
> On Mon, 2020-08-10 at 19:33 -0700, longli@linuxonhyperv.com wrote:
>> From: Stephen Hemminger <stephen@networkplumber.org>
>>
>> The data from the host is trusted but checked by the driver.
>> One check that is missing is that the packet offset and length
>> might cause wraparound.
>>
>> Cc: stable@dpdk.org
>>
>> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
>> Signed-off-by: Long Li <longli@microsoft.com>
>> ---
>>   drivers/net/netvsc/hn_rxtx.c | 6 ++++--
>>   1 file changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/net/netvsc/hn_rxtx.c b/drivers/net/netvsc/hn_rxtx.c
>> index a388ff258..d8d3f07f5 100644
>> --- a/drivers/net/netvsc/hn_rxtx.c
>> +++ b/drivers/net/netvsc/hn_rxtx.c
>> @@ -666,7 +666,8 @@ static void hn_rndis_rx_data(struct hn_rx_queue *rxq,
>>   			     struct hn_rx_bufinfo *rxb,
>>   			     void *data, uint32_t dlen)
>>   {
>> -	unsigned int data_off, data_len, pktinfo_off, pktinfo_len;
>> +	unsigned int data_off, data_len, total_len;
>> +	unsigned int pktinfo_off, pktinfo_len;
>>   	const struct rndis_packet_msg *pkt = data;
>>   	struct hn_rxinfo info = {
>>   		.vlan_info = HN_NDIS_VLAN_INFO_INVALID,
>> @@ -711,7 +712,8 @@ static void hn_rndis_rx_data(struct hn_rx_queue *rxq,
>>   			goto error;
>>   	}
>>   
>> -	if (unlikely(data_off + data_len > pkt->len))
>> +	if (__builtin_add_overflow(data_off, data_len, &total_len) ||
>> +	    total_len > pkt->len)
>>   		goto error;
>>   
>>   	if (unlikely(data_len < RTE_ETHER_HDR_LEN))
> 
> This patch breaks the build with GCC < 5 (CentOS 7, RHEL 7, SLE 12) as
> __builtin_add_overflow is not available. Could you please send a follow
> up to fix it?
> 

It should be already fixed in the repo:
https://git.dpdk.org/dpdk/commit/?id=d73543b5f46d

Are you getting the build error with 20.11-rc1?

  reply	other threads:[~2020-10-27 23:07 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-11  2:33 [dpdk-stable] [PATCH 1/4] net/netvsc: move rxbuf_info from per-device to per-queue longli
2020-08-11  2:33 ` [dpdk-stable] [PATCH 4/4] net/netvsc: check for overflow on packet info from host longli
2020-08-11 15:42   ` Stephen Hemminger
2020-10-27 17:10   ` [dpdk-stable] [dpdk-dev] " Luca Boccassi
2020-10-27 23:07     ` Ferruh Yigit [this message]
2020-10-28 11:08       ` Luca Boccassi
2020-10-29  8:43         ` Ferruh Yigit
2020-08-16 23:11 ` [dpdk-stable] [dpdk-dev] [PATCH 1/4] net/netvsc: move rxbuf_info from per-device to per-queue Stephen Hemminger
2020-08-19 15:36   ` 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=6b38cad9-f02c-38c2-8abf-c1bd1a56422a@intel.com \
    --to=ferruh.yigit@intel.com \
    --cc=bluca@debian.org \
    --cc=dev@dpdk.org \
    --cc=haiyangz@microsoft.com \
    --cc=longli@microsoft.com \
    --cc=stable@dpdk.org \
    --cc=stephen@networkplumber.org \
    --cc=sthemmin@microsoft.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).