DPDK patches and discussions
 help / color / mirror / Atom feed
From: Bruce Richardson <bruce.richardson@intel.com>
To: John Daley <johndale@cisco.com>
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH v3 1/2] enic: fix seg fault when releasing queues
Date: Fri, 10 Jun 2016 10:22:36 +0100	[thread overview]
Message-ID: <20160610092236.GA11860@bricha3-MOBL3> (raw)
In-Reply-To: <1465498569-5857-2-git-send-email-johndale@cisco.com>

On Thu, Jun 09, 2016 at 11:56:08AM -0700, John Daley wrote:
> If device configuration failed due to a lack of resources, such as
> if more queues are requested than are available, the queue release
> function is called with NULL pointers which were being dereferenced.
> 
> Skip releasing queues if they are NULL pointers.
> 
> Fixes: fefed3d1e62c ("enic: new driver")
> Signed-off-by: John Daley <johndale@cisco.com>
> ---
> 
> v3: bail out of free rq function if rq is null instead of if
> around != NULL.
> 
>  drivers/net/enic/enic_main.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c
> index 996f999..5939b9d 100644
> --- a/drivers/net/enic/enic_main.c
> +++ b/drivers/net/enic/enic_main.c
> @@ -429,6 +429,9 @@ void enic_free_rq(void *rxq)
>  	struct vnic_rq *rq = (struct vnic_rq *)rxq;
>  	struct enic *enic = vnic_dev_priv(rq->vdev);

This doesn't look safe to me. You are referencing the pointer before checking
it for NULL.

>  
> +	if (rxq == NULL)
> +		return;
> +

/Bruce

>  	enic_rxmbuf_queue_release(enic, rq);
>  	rte_free(rq->mbuf_ring);
>  	rq->mbuf_ring = NULL;
> -- 
> 2.7.0
> 

  reply	other threads:[~2016-06-10  9:22 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-25 20:18 [dpdk-dev] [PATCH] " John Daley
2016-05-26  2:45 ` [dpdk-dev] [PATCH v2] " John Daley
2016-06-09 16:08   ` Bruce Richardson
2016-06-09 18:56     ` [dpdk-dev] [PATCH v3 0/2] " John Daley
2016-06-09 18:56       ` [dpdk-dev] [PATCH v3 1/2] " John Daley
2016-06-10  9:22         ` Bruce Richardson [this message]
2016-06-11 17:27           ` [dpdk-dev] [PATCH v4 " John Daley
2016-06-11 17:27             ` [dpdk-dev] [PATCH v4 2/2] enic: improve out of resources error handling John Daley
2016-06-13 14:23             ` [dpdk-dev] [PATCH v4 1/2] enic: fix seg fault when releasing queues Bruce Richardson
2016-06-09 18:56       ` [dpdk-dev] [PATCH v3 2/2] enic: more specific out of resources error messages John Daley

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=20160610092236.GA11860@bricha3-MOBL3 \
    --to=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=johndale@cisco.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).