From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id D99AF42415; Thu, 19 Jan 2023 11:32:48 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C9E3B410DD; Thu, 19 Jan 2023 11:32:48 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 52B024068E for ; Thu, 19 Jan 2023 11:32:47 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674124366; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=9w8ySo1PvEdQe/wYI/1lv4K5TfUvoeLGD4/V8wwrxws=; b=atFHxruYq5x0qrQzHgYhS2LY4j5wcvQe6QnVfM+MTNUGsJpj3d25s1D06X+2Efo2nztPKT iDctNCvX3TBJKzTcoxTYeU1XbeG8STav00aXQXlxMNVF4tlTOYQhrGeLtiFT7ZdiTNY+p0 debAmmEkL+flkPLePcJMKsoEaEXjnbI= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-272-aNgS1_NxP3W2wPPItwcUkA-1; Thu, 19 Jan 2023 05:32:40 -0500 X-MC-Unique: aNgS1_NxP3W2wPPItwcUkA-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3A7E4811E9C; Thu, 19 Jan 2023 10:32:40 +0000 (UTC) Received: from dmarchan.redhat.com (ovpn-193-92.brq.redhat.com [10.40.193.92]) by smtp.corp.redhat.com (Postfix) with ESMTP id ED97B39D93; Thu, 19 Jan 2023 10:32:38 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: stable@dpdk.org, Jerin Jacob , Kiran Kumar K , Nithin Dabilpuram , Pavan Nikhilesh Subject: [PATCH] graph: fix node shrink Date: Thu, 19 Jan 2023 11:32:34 +0100 Message-Id: <20230119103234.841173-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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 --- 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