DPDK patches and discussions
 help / color / mirror / Atom feed
From: David Marchand <david.marchand@redhat.com>
To: dev@dpdk.org
Cc: 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: [PATCH] graph: fix node shrink
Date: Thu, 19 Jan 2023 11:32:34 +0100	[thread overview]
Message-ID: <20230119103234.841173-1-david.marchand@redhat.com> (raw)

If the node id check failed, graph_lock was not taken before releasing.

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


             reply	other threads:[~2023-01-19 10:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-19 10:32 David Marchand [this message]
2023-01-19 13:57 ` [EXT] " Kiran Kumar Kokkilagadda
2023-01-23 13:32 ` Jerin Jacob
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=20230119103234.841173-1-david.marchand@redhat.com \
    --to=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).