patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Jerin Jacob <jerinjacobk@gmail.com>
To: David Marchand <david.marchand@redhat.com>
Cc: dev@dpdk.org, stable@dpdk.org, Jerin Jacob <jerinj@marvell.com>,
	 Kiran Kumar K <kirankumark@marvell.com>,
	Nithin Dabilpuram <ndabilpuram@marvell.com>,
	 Pavan Nikhilesh <pbhagavatula@marvell.com>
Subject: Re: [PATCH] graph: fix node shrink
Date: Mon, 23 Jan 2023 19:02:48 +0530	[thread overview]
Message-ID: <CALBAE1MBCiTq0MRNEDG-63dtyJsKHFFOgFmjVtJjKzzZwpShXQ@mail.gmail.com> (raw)
In-Reply-To: <20230119103234.841173-1-david.marchand@redhat.com>

On Thu, Jan 19, 2023 at 4:02 PM David Marchand
<david.marchand@redhat.com> wrote:
>
> If the node id check failed, graph_lock was not taken before releasing.

Thanks for the fix.


Why not this oneline fix?

[main][dpdk.org] $ git diff
diff --git a/lib/graph/node.c b/lib/graph/node.c
index fc6345de07..89cdcf0207 100644
--- a/lib/graph/node.c
+++ b/lib/graph/node.c
@@ -293,8 +293,8 @@ rte_node_edge_shrink(rte_node_t id, rte_edge_t size)
        rte_edge_t rc = RTE_EDGE_ID_INVALID;
        struct node *node;

-       NODE_ID_CHECK(id);
        graph_spinlock_lock();
+       NODE_ID_CHECK(id);

        STAILQ_FOREACH(node, &node_list, next) {
                if (node->id == id) {


>
> Fixes: c59dac2ca14a ("graph: implement node operations")
> Cc: stable@dpdk.org
>
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---
>  lib/graph/node.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/lib/graph/node.c b/lib/graph/node.c
> index fc6345de07..149414dcd9 100644
> --- a/lib/graph/node.c
> +++ b/lib/graph/node.c
> @@ -300,16 +300,16 @@ rte_node_edge_shrink(rte_node_t id, rte_edge_t size)
>                 if (node->id == id) {
>                         if (node->nb_edges < size) {
>                                 rte_errno = E2BIG;
> -                               goto fail;
> +                       } else {
> +                               node->nb_edges = size;
> +                               rc = size;
>                         }
> -                       node->nb_edges = size;
> -                       rc = size;
>                         break;
>                 }
>         }
>
> -fail:
>         graph_spinlock_unlock();
> +fail:
>         return rc;
>  }
>
> --
> 2.39.0
>

  parent reply	other threads:[~2023-01-23 13:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-19 10:32 David Marchand
2023-01-19 13:57 ` [EXT] " Kiran Kumar Kokkilagadda
2023-01-23 13:32 ` Jerin Jacob [this message]
2023-01-23 13:50   ` David Marchand
2023-01-23 13:53     ` Jerin Jacob
2023-01-31 10:13 ` David Marchand

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=CALBAE1MBCiTq0MRNEDG-63dtyJsKHFFOgFmjVtJjKzzZwpShXQ@mail.gmail.com \
    --to=jerinjacobk@gmail.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=jerinj@marvell.com \
    --cc=kirankumark@marvell.com \
    --cc=ndabilpuram@marvell.com \
    --cc=pbhagavatula@marvell.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).