DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Ananyev, Konstantin" <konstantin.ananyev@intel.com>
To: "Legacy, Allain (Wind River)" <allain.legacy@windriver.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>,
	"Peters, Matt (Wind River)" <matt.peters@windriver.com>,
	"stable@dpdk.org" <stable@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH v2] ip_frag: fix double free of chained mbufs
Date: Wed, 11 Apr 2018 12:10:42 +0000	[thread overview]
Message-ID: <2601191342CEEE43887BDE71AB977258AE9139B5@IRSMSX102.ger.corp.intel.com> (raw)
In-Reply-To: <20180319142523.22163-1-allain.legacy@windriver.com>



> -----Original Message-----
> From: Allain Legacy [mailto:allain.legacy@windriver.com]
> Sent: Monday, March 19, 2018 2:25 PM
> To: Ananyev, Konstantin <konstantin.ananyev@intel.com>
> Cc: dev@dpdk.org; Peters, Matt (Wind River) <matt.peters@windriver.com>; stable@dpdk.org
> Subject: [PATCH v2] ip_frag: fix double free of chained mbufs
> 
> The first mbuf and the last mbuf to be visited in the preceding loop
> are not set to NULL in the fragmentation table.  This creates the
> possibility of a double free when the fragmentation table is later freed
> with rte_ip_frag_table_destroy().
> 
> Fixes: 95908f52393d ("ip_frag: free mbufs on reassembly table destroy")
> 
> Signed-off-by: Allain Legacy <allain.legacy@windriver.com>
> ---
>  lib/librte_ip_frag/rte_ipv4_reassembly.c | 2 ++
>  lib/librte_ip_frag/rte_ipv6_reassembly.c | 2 ++
>  2 files changed, 4 insertions(+)
> 
> diff --git a/lib/librte_ip_frag/rte_ipv4_reassembly.c b/lib/librte_ip_frag/rte_ipv4_reassembly.c
> index 82e831ca3..4956b99ea 100644
> --- a/lib/librte_ip_frag/rte_ipv4_reassembly.c
> +++ b/lib/librte_ip_frag/rte_ipv4_reassembly.c
> @@ -59,7 +59,9 @@ ipv4_frag_reassemble(struct ip_frag_pkt *fp)
>  	/* chain with the first fragment. */
>  	rte_pktmbuf_adj(m, (uint16_t)(m->l2_len + m->l3_len));
>  	rte_pktmbuf_chain(fp->frags[IP_FIRST_FRAG_IDX].mb, m);
> +	fp->frags[curr_idx].mb = NULL;
>  	m = fp->frags[IP_FIRST_FRAG_IDX].mb;
> +	fp->frags[IP_FIRST_FRAG_IDX].mb = NULL;
> 
>  	/* update mbuf fields for reassembled packet. */
>  	m->ol_flags |= PKT_TX_IP_CKSUM;
> diff --git a/lib/librte_ip_frag/rte_ipv6_reassembly.c b/lib/librte_ip_frag/rte_ipv6_reassembly.c
> index 3479fabb8..db249fe60 100644
> --- a/lib/librte_ip_frag/rte_ipv6_reassembly.c
> +++ b/lib/librte_ip_frag/rte_ipv6_reassembly.c
> @@ -82,7 +82,9 @@ ipv6_frag_reassemble(struct ip_frag_pkt *fp)
>  	/* chain with the first fragment. */
>  	rte_pktmbuf_adj(m, (uint16_t)(m->l2_len + m->l3_len));
>  	rte_pktmbuf_chain(fp->frags[IP_FIRST_FRAG_IDX].mb, m);
> +	fp->frags[curr_idx].mb = NULL;
>  	m = fp->frags[IP_FIRST_FRAG_IDX].mb;
> +	fp->frags[IP_FIRST_FRAG_IDX].mb = NULL;
> 
>  	/* update mbuf fields for reassembled packet. */
>  	m->ol_flags |= PKT_TX_IP_CKSUM;
> --

Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>

> 2.12.1

  parent reply	other threads:[~2018-04-11 12:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-19 14:18 [dpdk-dev] [PATCH] " Allain Legacy
2018-03-19 14:25 ` [dpdk-dev] [PATCH v2] " Allain Legacy
2018-04-10 15:15   ` Thomas Monjalon
2018-04-11 11:02   ` Ananyev, Konstantin
2018-04-11 11:28     ` Legacy, Allain
2018-04-11 12:09       ` Ananyev, Konstantin
2018-04-11 12:10   ` Ananyev, Konstantin [this message]
2018-04-15 12:46     ` 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=2601191342CEEE43887BDE71AB977258AE9139B5@IRSMSX102.ger.corp.intel.com \
    --to=konstantin.ananyev@intel.com \
    --cc=allain.legacy@windriver.com \
    --cc=dev@dpdk.org \
    --cc=matt.peters@windriver.com \
    --cc=stable@dpdk.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).