From: Thomas Monjalon <thomas@monjalon.net>
To: Andrew Rybchenko <arybchenko@solarflare.com>
Cc: dev@dpdk.org, Ferruh Yigit <ferruh.yigit@intel.com>, stable@dpdk.org
Subject: Re: [dpdk-dev] [PATCH v2] ethdev: avoid usage of uninit device info in bad port case
Date: Tue, 23 Jul 2019 15:39:06 +0200 [thread overview]
Message-ID: <1746857.eD02m7bUWG@xps> (raw)
In-Reply-To: <ec2b6790-f8ce-70fc-3f53-6a999a51d904@solarflare.com>
23/07/2019 15:34, Andrew Rybchenko:
> On 7/23/19 4:14 PM, Thomas Monjalon wrote:
> > 23/07/2019 14:11, Andrew Rybchenko:
> >> rte_eth_dev_info_get() returns void and caller does know if the function
> >> does its job or not. Changing of the return value to int would be
> >> API/ABI breakage which requires deprecation process and cannot be
> >> backported to stable branches. For now, make sure that device info is
> >> initialized even in the case of invalid port ID.
> >>
> >> Fixes: a30268e9a2d0 ("ethdev: reset whole dev info structure before filling")
> >> Cc: stable@dpdk.org
> >>
> >> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
> >> ---
> >> --- a/lib/librte_ethdev/rte_ethdev.c
> >> +++ b/lib/librte_ethdev/rte_ethdev.c
> >> + /*
> >> + * Init dev_info before port_id check since caller does not have
> >> + * return status and does not know if get is successful or not.
> >> + */
> >> + memset(dev_info, 0, sizeof(struct rte_eth_dev_info));
> > If someone was using a canary to detect failure, it will be resetted.
>
> I've not thought about such ways to check. I would expected check
> for not NULL device or driver_name. It is not defined behaviour of
> the function to not touch dev_info in the case of bad port ID.
>
> > Why is it urgent to have this workaround?
>
> Nothing really urgent, but I still think that it is a right fix to be
> applied and backported to stable branches.
> I really met calls with invalid port ID and it took some time
> to understand where uninitialized data come from.
>
> > Can we wait one more release for the definitive fix with error code?
>
> No strong opinion, but definitive fix will not be backported.
You're right.
Acked-by: Thomas Monjalon <thomas@monjalon.net>
next prev parent reply other threads:[~2019-07-23 13:39 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-23 9:13 [dpdk-dev] [PATCH] " Andrew Rybchenko
2019-07-23 10:40 ` Ferruh Yigit
2019-07-23 12:16 ` Andrew Rybchenko
2019-07-23 12:50 ` Thomas Monjalon
2019-07-23 12:11 ` [dpdk-dev] [PATCH v2] " Andrew Rybchenko
2019-07-23 13:14 ` Thomas Monjalon
2019-07-23 13:34 ` Andrew Rybchenko
2019-07-23 13:39 ` Thomas Monjalon [this message]
2019-07-23 18:45 ` 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=1746857.eD02m7bUWG@xps \
--to=thomas@monjalon.net \
--cc=arybchenko@solarflare.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@intel.com \
--cc=stable@dpdk.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).