From: Olivier Matz <olivier.matz@6wind.com>
To: dev@dpdk.org
Cc: Keith Wiles <keith.wiles@intel.com>,
stephen@networkplumber.org, jerin.jacob@caviumnetworks.com,
stable@dpdk.org
Subject: [dpdk-dev] [PATCH v3] mbuf: fix freeing of NULL mbuf when debug enabled
Date: Mon, 29 Jan 2018 10:39:23 +0100 [thread overview]
Message-ID: <20180129093923.18588-1-olivier.matz@6wind.com> (raw)
In-Reply-To: <20180109142928.81687-1-keith.wiles@intel.com>
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 <keith.wiles@intel.com>
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
---
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
next prev parent reply other threads:[~2018-01-29 9:39 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-08 15:34 [dpdk-dev] [PATCH] mbuf:using sanity checks do not panic on null mbuf Keith Wiles
2018-01-08 15:39 ` Stephen Hemminger
2018-01-08 15:41 ` Wiles, Keith
2018-01-09 4:39 ` Jerin Jacob
2018-01-09 14:29 ` [dpdk-dev] [PATCH v2] " Keith Wiles
2018-01-16 14:04 ` Olivier Matz
2018-01-16 14:19 ` Wiles, Keith
2018-01-29 9:39 ` Olivier Matz [this message]
2018-01-29 15:58 ` [dpdk-dev] [PATCH v3] mbuf: fix freeing of NULL mbuf when debug enabled Thomas Monjalon
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=20180129093923.18588-1-olivier.matz@6wind.com \
--to=olivier.matz@6wind.com \
--cc=dev@dpdk.org \
--cc=jerin.jacob@caviumnetworks.com \
--cc=keith.wiles@intel.com \
--cc=stable@dpdk.org \
--cc=stephen@networkplumber.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).