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 963714246A; Mon, 23 Jan 2023 14:33:17 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 36F02400EF; Mon, 23 Jan 2023 14:33:17 +0100 (CET) Received: from mail-vs1-f53.google.com (mail-vs1-f53.google.com [209.85.217.53]) by mails.dpdk.org (Postfix) with ESMTP id AD9F4400D4; Mon, 23 Jan 2023 14:33:15 +0100 (CET) Received: by mail-vs1-f53.google.com with SMTP id t10so12860853vsr.3; Mon, 23 Jan 2023 05:33:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=bCNK4bptqkfMscdtfk6excZeKkQPYzrAZkmuenoxZ2o=; b=DsSK7wIrW/uC6/guzixiLk+R6HtZVi/oWRVjP2HEgAoUdnLa5JNlWCptRJgicRMAiK XQixtjBPZgKnQFI+A4IDfE1Mw+9Re3YWMdnmnD86fIEn0VWqMHXFoPzmfvyCkSGtWMyZ VjLosvlCDP3prk0AAnh8fmr/H4q38K856f+c1UA/uE31snMiwuWVtCgc0ukE5ZZu7mL0 +pUot/7WuLBNplVmvmtTF3MsWuA7RRk90QfTYlOIGxgYBmXb0M5oAiVOY1fCBXhOch+X Rit/A/sXraf5fK7blX2mJUUJ7puMgHZKC9R/VypRW9gx+oCt1TUfydi4AYWr4gYw4Q+b M0Tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=bCNK4bptqkfMscdtfk6excZeKkQPYzrAZkmuenoxZ2o=; b=rjVCSIUP+ts0xrRxtMaQeNB8fTRrej68cbf8lKlPgTgS0pNEyhXhFkHtzjF9r7dSGC fGZ9zzst/lOEy3A1Z09YKIEHzYURhrRWcO4q1wEzb8TGymi6IL+0iIg0HTdnkJP/xyAH mT1/+LX42EkYdq6NJtFBcQnheNPF2b9OjafFEVrsYQAW0kTDxcNjol/kh7pg6ST7oASn mQJ8yQ8yAxi3LZJ9sHvXCV0Jtxe+8rEJwKSCIL69I0LdcZ3tR3Bfwh4+pjxLyekJ/7Cb ZofppWH9l24TT2JzR1rR6X9/o2fFpKC2Ye4ULEIBUy7FDOLQhLQQTzQi+R6ZSMs+3T6i kiAQ== X-Gm-Message-State: AFqh2kpRy5Hzf4rOV8xk0cjNJNAr2XrlX0YbXYTgyf2IKWl/1sDBt03C AO/gFU/vm69qSYDZ2RfyaqYBvQNrvi5LxMcx4YT1D2fN8Q7sZw== X-Google-Smtp-Source: AMrXdXv6YiKFb4egdotOVWqYdUsUt5w+ks2aDrYF8BS4g7yflkZDcbHDnovyFZ+DxLdU9wk9JKKttLV5OonCaSsmo+U= X-Received: by 2002:a05:6102:5124:b0:3d3:c7fb:d602 with SMTP id bm36-20020a056102512400b003d3c7fbd602mr3318878vsb.31.1674480794953; Mon, 23 Jan 2023 05:33:14 -0800 (PST) MIME-Version: 1.0 References: <20230119103234.841173-1-david.marchand@redhat.com> In-Reply-To: <20230119103234.841173-1-david.marchand@redhat.com> From: Jerin Jacob Date: Mon, 23 Jan 2023 19:02:48 +0530 Message-ID: Subject: Re: [PATCH] graph: fix node shrink To: David Marchand Cc: dev@dpdk.org, stable@dpdk.org, Jerin Jacob , Kiran Kumar K , Nithin Dabilpuram , Pavan Nikhilesh Content-Type: text/plain; charset="UTF-8" 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 On Thu, Jan 19, 2023 at 4:02 PM David Marchand 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 > --- > 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 >