DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Chen, Jing D" <jing.d.chen@intel.com>
To: "Qiu, Michael" <michael.qiu@intel.com>, "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH] librte_pmd_fm10k: Set pointer to NULL after free
Date: Mon, 16 Mar 2015 01:46:13 +0000
Message-ID: <4341B239C0EFF9468EE453F9E9F4604D0169D833@shsmsx102.ccr.corp.intel.com> (raw)
In-Reply-To: <1425628607-1497-1-git-send-email-michael.qiu@intel.com>



> -----Original Message-----
> From: Qiu, Michael
> Sent: Friday, March 06, 2015 3:57 PM
> To: dev@dpdk.org
> Cc: Chen, Jing D; Qiu, Michael
> Subject: [PATCH] librte_pmd_fm10k: Set pointer to NULL after free
> 
> It could be a potential not safe issue.
> 
> Signed-off-by: Michael Qiu <michael.qiu@intel.com>
> ---
>  lib/librte_pmd_fm10k/fm10k_ethdev.c | 14 +++++++++++---
>  1 file changed, 11 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/librte_pmd_fm10k/fm10k_ethdev.c
> b/lib/librte_pmd_fm10k/fm10k_ethdev.c
> index 07ea1e7..30962d3 100644
> --- a/lib/librte_pmd_fm10k/fm10k_ethdev.c
> +++ b/lib/librte_pmd_fm10k/fm10k_ethdev.c
> @@ -142,9 +142,12 @@ rx_queue_free(struct fm10k_rx_queue *q)
>  	if (q) {
>  		PMD_INIT_LOG(DEBUG, "Freeing rx queue %p", q);
>  		rx_queue_clean(q);
> -		if (q->sw_ring)
> +		if (q->sw_ring) {
>  			rte_free(q->sw_ring);
> +			q->sw_ring = NULL;
> +		}
>  		rte_free(q);
> +		q = NULL;
>  	}
>  }
> 
> @@ -225,11 +228,16 @@ tx_queue_free(struct fm10k_tx_queue *q)
>  	if (q) {
>  		PMD_INIT_LOG(DEBUG, "Freeing tx queue %p", q);
>  		tx_queue_clean(q);
> -		if (q->rs_tracker.list)
> +		if (q->rs_tracker.list) {
>  			rte_free(q->rs_tracker.list);
> -		if (q->sw_ring)
> +			q->rs_tracker.list = NULL;
> +		}
> +		if (q->sw_ring) {
>  			rte_free(q->sw_ring);
> +			q->sw_ring = NULL;
> +		}
>  		rte_free(q);
> +		q = NULL;
>  	}
>  }
> 
> --
> 1.9.3

Acked-by: Jing Chen <jing.d.chen@intel.com>

  reply	other threads:[~2015-03-16  1:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-06  7:56 Michael Qiu
2015-03-16  1:46 ` Chen, Jing D [this message]
2015-03-16 23:42   ` 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=4341B239C0EFF9468EE453F9E9F4604D0169D833@shsmsx102.ccr.corp.intel.com \
    --to=jing.d.chen@intel.com \
    --cc=dev@dpdk.org \
    --cc=michael.qiu@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