From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id D84E0A0C52;
	Wed, 24 Nov 2021 13:57:18 +0100 (CET)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id C814841C3C;
	Wed, 24 Nov 2021 13:57:18 +0100 (CET)
Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com
 [209.85.128.50]) by mails.dpdk.org (Postfix) with ESMTP id 44C29411E6
 for <dev@dpdk.org>; Wed, 24 Nov 2021 13:57:17 +0100 (CET)
Received: by mail-wm1-f50.google.com with SMTP id
 j140-20020a1c2392000000b003399ae48f58so5313588wmj.5
 for <dev@dpdk.org>; Wed, 24 Nov 2021 04:57:17 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind.com; s=google;
 h=from:to:cc:subject:date:message-id:in-reply-to:references
 :mime-version:content-transfer-encoding;
 bh=AAk9iboWgp/4hNA+ApDsbvbEBaDNjvArONPriwUfCYw=;
 b=InJ6IwbFP4dDIfDorRjkY8+M7ijivf2FIqKSoEimSPYzrY5xG92J4HoUG/uNJXbhFU
 5LoOMIQCgw4Cz+yHT9uBQOUybnA+sqwUCEhOqI9r0kiWbx6A0sQWXMSvU/vck0qFPTZI
 0lpPqu7YraPRwvNDkiInZeQ3wvJyvOo6kCClBQs1I7zZbYQJRhz8sLSpDhrnoCowq4yn
 ybU+Ve0fdWvc0NfQhfs5BKtc0lrAR3oZl/pYOwSgbrZt552K3FwEHgQKkPuiRjNAkEPN
 cvMeuL3ox+ugpCoPQJ/QGfN9ealOMQSGUskivom3lZXpXgGknzWOmf2I2e3YdpDYOFoX
 9Kcw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=AAk9iboWgp/4hNA+ApDsbvbEBaDNjvArONPriwUfCYw=;
 b=mIEpXQRWFKBvE5U4zvlLQexWMPCiyYSM+HJR/LKKQBjNxa98QpLeAMaEaUVR0SnIBg
 JyI+O4H9JAJr4i/gn7XdnMNEirw0Z2WCcUVH1mt+Lzwakee5PHbDnL7pnUkG648/3Kaz
 +Y30bUhcTJJc3ydfRb16Gx4foge3rgMhZMxI4y3B393wr15yXbwUaORaAfiDHEn9jk79
 CZo0wfueBtowQmpkfUZ93EzehvbKTZyHE+/Er66XPlxe3J7SenJ5Vs/g1DaLdeyy6VR/
 zOrdQBggJFcOBZbhKi/F7FKM3LaX/iPNaunZKR2/gmsdMVJGN9OLfiQafHC68QCo1czc
 8MNQ==
X-Gm-Message-State: AOAM532T/w6g5yTDiAP7ysGcRzGjopgkW90l42B8+W8hd7mpK1JfmliL
 Cpew0cBCR0cL/8mfFkzc2aK8V6ovEBehlA==
X-Google-Smtp-Source: ABdhPJxQ05DB9+of8KKwM6VYuTlvxa/X35triapB2Cx0ps5w59QdTHRTKYDX4D5i/6/y/8PH4kh78w==
X-Received: by 2002:a1c:770e:: with SMTP id t14mr14013254wmi.173.1637758636964; 
 Wed, 24 Nov 2021 04:57:16 -0800 (PST)
Received: from gojira.dev.6wind.com ([185.13.181.2])
 by smtp.gmail.com with ESMTPSA id m20sm5390189wmq.11.2021.11.24.04.57.15
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Wed, 24 Nov 2021 04:57:16 -0800 (PST)
From: Olivier Matz <olivier.matz@6wind.com>
To: dev@dpdk.org
Cc: Alexander Bechikov <asb.tyum@gmail.com>,
	stable@dpdk.org
Subject: [PATCH v3] mbuf: fix dump of dynamic fields and flags
Date: Wed, 24 Nov 2021 13:57:04 +0100
Message-Id: <20211124125704.26054-1-olivier.matz@6wind.com>
X-Mailer: git-send-email 2.30.2
In-Reply-To: <20211027111118.395928-1-asb.tyum@gmail.com>
References: <20211027111118.395928-1-asb.tyum@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org

From: Alexander Bechikov <asb.tyum@gmail.com>

The dump of dynamic fields and flags fails if the shm is already
allocated. Add a check to fix the issue.

Cc: stable@dpdk.org
Fixes: d4902ed31c63 ("mbuf: check shared memory before dumping dynamic space")

Signed-off-by: Alexander Bechikov <asb.tyum@gmail.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
---
Hi Alexander,

Sorry for late feedback, I forgot to reply to your v2.
I'm resending your fix with the 2 patches merged together, so it
can be included in 21.11.

Thanks,
Olivier


v3:
* Merge the 2 patches from v2 and add a commit log
v2:
* Drop changes with log message from v1, because rte_errno is not always set
---
 lib/mbuf/rte_mbuf_dyn.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/mbuf/rte_mbuf_dyn.c b/lib/mbuf/rte_mbuf_dyn.c
index db8e020665..4ae79383b5 100644
--- a/lib/mbuf/rte_mbuf_dyn.c
+++ b/lib/mbuf/rte_mbuf_dyn.c
@@ -531,7 +531,7 @@ void rte_mbuf_dyn_dump(FILE *out)
 	size_t i;
 
 	rte_mcfg_tailq_write_lock();
-	if (init_shared_mem() < 0) {
+	if (shm == NULL && init_shared_mem() < 0) {
 		rte_mcfg_tailq_write_unlock();
 		return;
 	}
-- 
2.30.2