DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jerin Jacob <jerin.jacob@caviumnetworks.com>
To: Harry van Haaren <harry.van.haaren@intel.com>
Cc: dev@dpdk.org, bruce.richardson@intel.com, stable@dpdk.org,
	thomas@monjalon.net
Subject: Re: [dpdk-dev] [PATCH] event: fix check in ring_init() in event ring code
Date: Thu, 2 Aug 2018 18:13:22 +0530	[thread overview]
Message-ID: <20180802124321.GA9220@jerin> (raw)
In-Reply-To: <1533198964-30218-1-git-send-email-harry.van.haaren@intel.com>

-----Original Message-----
> Date: Thu, 2 Aug 2018 09:36:04 +0100
> From: Harry van Haaren <harry.van.haaren@intel.com>
> To: dev@dpdk.org
> CC: Harry van Haaren <harry.van.haaren@intel.com>,
>  bruce.richardson@intel.com, stable@dpdk.org, thomas@monjalon.net,
>  jerin.jacob@caviumnetworks.com
> Subject: [PATCH] event: fix check in ring_init() in event ring code
> X-Mailer: git-send-email 2.7.4
> 
> External Email
> 
> This commit fixes a bug in a 32-bit environment where the
> generic ring_init() would fail, but given the interaction
> with memzones the next iteration of the event_ring_autotest
> would actually *pass* because the ring in question would
> exist already an be looked-up.
> 
> This commit rightly error checks the result of ring_init(),
> and calls rte_free() on the memory as required.
> 
> Fixes: dc39e2f359b5 ("eventdev: add ring structure for events")
> Cc: bruce.richardson@intel.com
> Cc: stable@dpdk.org
> 
> Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>


There is one check-git-log.sh issue

Wrong headline format:
	event: fix check in ring_init() in event ring code

> 
> ---
> 
> Cc: thomas@monjalon.net
> Cc: jerin.jacob@caviumnetworks.com
> 
> Please consider this for RC3, as it fixes the unit tests
> on 32-bit systems.
> ---
>  lib/librte_eventdev/rte_event_ring.c | 13 ++++++++-----
>  1 file changed, 8 insertions(+), 5 deletions(-)
> 
> diff --git a/lib/librte_eventdev/rte_event_ring.c b/lib/librte_eventdev/rte_event_ring.c
> index eb67751..5791928 100644
> --- a/lib/librte_eventdev/rte_event_ring.c
> +++ b/lib/librte_eventdev/rte_event_ring.c
> @@ -82,11 +82,14 @@ rte_event_ring_create(const char *name, unsigned int count, int socket_id,
>         mz = rte_memzone_reserve(mz_name, ring_size, socket_id, mz_flags);
>         if (mz != NULL) {
>                 r = mz->addr;
> -               /*
> -                * no need to check return value here, we already checked the
> -                * arguments above
> -                */
> -               rte_event_ring_init(r, name, requested_count, flags);
> +               /* Check return value in case rte_ring_init() fails on size */
> +               int err = rte_event_ring_init(r, name, requested_count, flags);
> +               if (err) {
> +                       RTE_LOG(ERR, RING, "Ring init failed\n");

shouldn't we do rte_memzone_free(mz);

> +                       rte_free(te);
> +                       rte_rwlock_write_unlock(RTE_EAL_TAILQ_RWLOCK);
> +                       return 0;

It should be return NULL?

> +               }
> 

With above changes:

Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>

>                 te->data = (void *) r;
>                 r->r.memzone = mz;
> --
> 2.7.4
> 

  reply	other threads:[~2018-08-02 12:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-02  8:36 Harry van Haaren
2018-08-02 12:43 ` Jerin Jacob [this message]
2018-08-02 14:43 ` [dpdk-dev] [PATCH v2] event: fix check in ring init() " Harry van Haaren
2018-08-05 12:52   ` 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=20180802124321.GA9220@jerin \
    --to=jerin.jacob@caviumnetworks.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=harry.van.haaren@intel.com \
    --cc=stable@dpdk.org \
    --cc=thomas@monjalon.net \
    /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).