DPDK patches and discussions
 help / color / mirror / Atom feed
From: Maxime Coquelin <maxime.coquelin@redhat.com>
To: Olivier Matz <olivier.matz@6wind.com>, dev@dpdk.org
Cc: Chenbo Xia <chenbo.xia@intel.com>,
	Zhihong Wang <zhihong.wang@intel.com>,
	 Flavio Leitner <fbl@sysclose.org>, yang_y_yi <yang_y_yi@163.com>,
	stable@dpdk.org
Subject: Re: [dpdk-dev] [PATCH] vhost: fix external mbuf creation
Date: Fri, 9 Oct 2020 09:24:07 +0200
Message-ID: <96ac84cd-40b2-0776-f562-ad25e8f25418@redhat.com> (raw)
In-Reply-To: <20201007125318.9850-1-olivier.matz@6wind.com>



On 10/7/20 2:53 PM, Olivier Matz wrote:
> In virtio_dev_extbuf_alloc(), the shinfo structure used to store
> the reference counter and the free callback of the external buffer
> is by default stored inside the mbuf data.
> 
> This is wrong because the mbuf (and its data) can be freed before
> the external buffer, for instance in the following situation:
> 
>   pkt2 = rte_pktmbuf_alloc(mp);
>   rte_pktmbuf_attach(pkt2, pkt);
>   rte_pktmbuf_free(pkt);
> 
> After this, pkt is freed, but it still contains shinfo, which is
> referenced by pkt2.
> 
> Fix this by always storing the shinfo beside the external buffer.
> 
> Fixes: c3ff0ac70acb ("vhost: improve performance by supporting large buffer")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
> ---
> 
> Hi,
> 
> I found this issue by code review while discussing about this
> patchset [1]. I did not tested the patch, but as I'm only removing
> one path among the two, I don't expect that it breaks anything.
> 
> [1] http://inbox.dpdk.org/dev/20200730120900.108232-1-yang_y_yi@163.com/
> 
> Regards,
> Olivier
> 
>  lib/librte_vhost/virtio_net.c | 30 ++++++++----------------------
>  1 file changed, 8 insertions(+), 22 deletions(-)

Applied to dpdk-next-virtio/main.

Thanks,
Maxime


  parent reply	other threads:[~2020-10-09  7:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-07 12:53 Olivier Matz
2020-10-09  7:15 ` Maxime Coquelin
2020-10-09  7:24 ` Maxime Coquelin [this message]
2020-10-09  8:47 ` yang_y_yi
2020-10-09  9:04 ` yang_y_yi

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=96ac84cd-40b2-0776-f562-ad25e8f25418@redhat.com \
    --to=maxime.coquelin@redhat.com \
    --cc=chenbo.xia@intel.com \
    --cc=dev@dpdk.org \
    --cc=fbl@sysclose.org \
    --cc=olivier.matz@6wind.com \
    --cc=stable@dpdk.org \
    --cc=yang_y_yi@163.com \
    --cc=zhihong.wang@intel.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