From: Ferruh Yigit <ferruh.yigit@intel.com>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: dev@dpdk.org, Anatoly Burakov <anatoly.burakov@intel.com>,
Keith Wiles <keith.wiles@intel.com>,
Olga Shern <olgas@mellanox.com>
Subject: Re: [dpdk-dev] [PATCH] net/tap: fix crash from unitialized memory in rte_flow_destroy
Date: Tue, 5 May 2020 09:09:07 +0100 [thread overview]
Message-ID: <cf7f046e-38f3-685d-7155-de8f5771be49@intel.com> (raw)
In-Reply-To: <20200501091955.3dc5fc61@hermes.lan>
On 5/1/2020 5:19 PM, Stephen Hemminger wrote:
> On Fri, 1 May 2020 17:01:40 +0100
> Ferruh Yigit <ferruh.yigit@intel.com> wrote:
>
>> On 4/27/2020 10:39 PM, Stephen Hemminger wrote:
>>> The TAP driver does not initialize all the elements of the rte_flow
>>> structure. This can lead to crash in rte_flow_destroy.
>>>
>>> (gdb) where
>>> flow=0x100e99280, error=0x0)
>>> at drivers/net/tap/tap_flow.c:1514
>>>
>>> (gdb) p remote_flow
>>> $1 = (struct rte_flow *) 0x6b6b6b6b6b6b6b6b
>>>
>>> Which is here:
>>> static int
>>> tap_flow_destroy_pmd(struct pmd_internals *pmd,
>>> struct rte_flow *flow,
>>> struct rte_flow_error *error)
>>> {
>>> struct rte_flow *remote_flow = flow->remote_flow;
>>> ...
>>> if (remote_flow) {
>>> remote_flow->msg.nh.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
>>>
>>> Simplest fix is to use rte_zmalloc() so remote_flow and other fields
>>> are always set at zero.
>>
>> Both 'rte_malloc' & 'rte_zmalloc' should be zeroing the allocated memory, unless
>> MALLOC_DEBUG config option set [1], if this is not the case the issue can be
>> still valid after this change.
>
> Malloc debug poisons memory to find bugs like this.
>
Fair enough, if that is the intention use 'rte_zmalloc' to clarify it.
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
next prev parent reply other threads:[~2020-05-05 8:09 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-27 21:39 Stephen Hemminger
2020-04-28 7:40 ` David Marchand
2020-05-01 16:01 ` Ferruh Yigit
2020-05-01 16:19 ` Stephen Hemminger
2020-05-05 8:09 ` Ferruh Yigit [this message]
2020-05-06 17:51 ` Ferruh Yigit
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=cf7f046e-38f3-685d-7155-de8f5771be49@intel.com \
--to=ferruh.yigit@intel.com \
--cc=anatoly.burakov@intel.com \
--cc=dev@dpdk.org \
--cc=keith.wiles@intel.com \
--cc=olgas@mellanox.com \
--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).