DPDK patches and discussions
 help / color / mirror / Atom feed
From: wangyunjian <wangyunjian@huawei.com>
To: Chas Williams <3chas3@gmail.com>, "dev@dpdk.org" <dev@dpdk.org>
Cc: "olivier.matz@6wind.com" <olivier.matz@6wind.com>,
	xudingke <xudingke@huawei.com>
Subject: Re: [dpdk-dev] [PATCH] net: check that seg is valid before dereference
Date: Tue, 29 Sep 2020 03:01:36 +0000
Message-ID: <34EFBCA9F01B0748BEB6B629CE643AE60DA7D32B@DGGEMM533-MBX.china.huawei.com> (raw)
In-Reply-To: <20200928153219.285343-1-3chas3@gmail.com>

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Chas Williams
> Sent: Monday, September 28, 2020 11:32 PM
> To: dev@dpdk.org
> Cc: olivier.matz@6wind.com; Chas Williams <3chas3@gmail.com>
> Subject: [dpdk-dev] [PATCH] net: check that seg is valid before dereference
> 
> If the overall pkt_len and segment lengths are out of agreement, it is possible
> for the seg to be NULL after the loop. Add assert to check this condition in
> debug builds.
> 
> Fixes: c442fed81bb9 ("net: add function to calculate checksum in mbuf")
> 
> Signed-off-by: Chas Williams <3chas3@gmail.com>
> ---
>  lib/librte_net/rte_ip.h | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/lib/librte_net/rte_ip.h b/lib/librte_net/rte_ip.h index
> fcd1eb342..6b3e4cdda 100644
> --- a/lib/librte_net/rte_ip.h
> +++ b/lib/librte_net/rte_ip.h
> @@ -225,6 +225,7 @@ rte_raw_cksum_mbuf(const struct rte_mbuf *m,
> uint32_t off, uint32_t len,
>  			break;
>  		off -= seglen;
>  	}
> +	RTE_ASSERT(seg != NULL);

Is it better to return an error code?

>  	seglen -= off;
>  	buf = rte_pktmbuf_mtod_offset(seg, const char *, off);
>  	if (seglen >= len) {
> --
> 2.26.2


  reply	other threads:[~2020-09-29  3:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-28 15:32 Chas Williams
2020-09-29  3:01 ` wangyunjian [this message]
2020-09-29 20:19   ` Chas Williams
2020-10-01 10:22 ` [dpdk-dev] [PATCH v2 1/2] " Chas Williams
2020-10-01 10:22   ` [dpdk-dev] [PATCH v2 2/2] net/virtio: check return from rte_raw_cksum_mbuf Chas Williams
2020-10-06 21:15     ` Thomas Monjalon
2020-10-09  7:14     ` Maxime Coquelin
2020-10-12 21:15       ` Thomas Monjalon

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=34EFBCA9F01B0748BEB6B629CE643AE60DA7D32B@DGGEMM533-MBX.china.huawei.com \
    --to=wangyunjian@huawei.com \
    --cc=3chas3@gmail.com \
    --cc=dev@dpdk.org \
    --cc=olivier.matz@6wind.com \
    --cc=xudingke@huawei.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

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git