From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from proxy.6wind.com (host.76.145.23.62.rev.coltfrance.com [62.23.145.76]) by dpdk.org (Postfix) with ESMTP id 178F11B3DE; Mon, 29 Jan 2018 10:39:38 +0100 (CET) Received: from glumotte.dev.6wind.com. (unknown [10.16.0.195]) by proxy.6wind.com (Postfix) with ESMTP id 888E7128950; Mon, 29 Jan 2018 10:37:33 +0100 (CET) From: Olivier Matz To: dev@dpdk.org Cc: Keith Wiles , stephen@networkplumber.org, jerin.jacob@caviumnetworks.com, stable@dpdk.org Date: Mon, 29 Jan 2018 10:39:23 +0100 Message-Id: <20180129093923.18588-1-olivier.matz@6wind.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180109142928.81687-1-keith.wiles@intel.com> References: <20180109142928.81687-1-keith.wiles@intel.com> Subject: [dpdk-dev] [PATCH v3] mbuf: fix freeing of NULL mbuf when debug enabled X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jan 2018 09:39:38 -0000 Do not panic when calling rte_pktmbuf_free(NULL) with mbuf debug enabled, it is a valid operation. Fixes: af75078fece3 ("first public release") Cc: stable@dpdk.org Reported-by: Keith Wiles Signed-off-by: Olivier Matz --- lib/librte_mbuf/rte_mbuf.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h index 4519fb303..719d04dda 100644 --- a/lib/librte_mbuf/rte_mbuf.h +++ b/lib/librte_mbuf/rte_mbuf.h @@ -1439,13 +1439,14 @@ rte_pktmbuf_free_seg(struct rte_mbuf *m) * segment is added back into its original mempool. * * @param m - * The packet mbuf to be freed. + * The packet mbuf to be freed. If NULL, the function does nothing. */ static inline void rte_pktmbuf_free(struct rte_mbuf *m) { struct rte_mbuf *m_next; - __rte_mbuf_sanity_check(m, 1); + if (m != NULL) + __rte_mbuf_sanity_check(m, 1); while (m != NULL) { m_next = m->next; -- 2.11.0