* [dpdk-stable] [PATCH] net/vdev_netvsc: fix automatic probing
@ 2018-05-21 16:23 Matan Azrad
2018-05-21 16:52 ` [dpdk-stable] [dpdk-dev] " Stephen Hemminger
2018-05-22 9:57 ` [dpdk-stable] " Ferruh Yigit
0 siblings, 2 replies; 4+ messages in thread
From: Matan Azrad @ 2018-05-21 16:23 UTC (permalink / raw)
To: dev; +Cc: Ferruh Yigit, stable
The vdev_netvsc driver allows an automatic probe in Hyper-V VM systems
unless it was already specified by the EAL command line.
The detection of a specified NetVSC device is wrongly done by comparing
the vdev_netvsc driver name to all the vdev devices names, including
the suffix device index. Thus, if the user specifies the vdev_netvsc
device by adding an index to the device name, the comparison fails.
Consequently, the vdev_netvsc driver may automatically probe NetVSC
devices, despite the NetVSC device that was specified by the EAL command
line.
Compare the vdev_netvsc driver name to the devices names without the
index.
Fixes: 56252de779a6 ("net/vdev_netvsc: add automatic probing")
Cc: stable@dpdk.org
Signed-off-by: Matan Azrad <matan@mellanox.com>
---
drivers/net/vdev_netvsc/vdev_netvsc.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/net/vdev_netvsc/vdev_netvsc.c b/drivers/net/vdev_netvsc/vdev_netvsc.c
index de2bd14..48717f2 100644
--- a/drivers/net/vdev_netvsc/vdev_netvsc.c
+++ b/drivers/net/vdev_netvsc/vdev_netvsc.c
@@ -39,6 +39,7 @@
#define VDEV_NETVSC_DRIVER net_vdev_netvsc
#define VDEV_NETVSC_DRIVER_NAME RTE_STR(VDEV_NETVSC_DRIVER)
+#define VDEV_NETVSC_DRIVER_NAME_LEN 15
#define VDEV_NETVSC_ARG_IFACE "iface"
#define VDEV_NETVSC_ARG_MAC "mac"
#define VDEV_NETVSC_ARG_FORCE "force"
@@ -798,7 +799,8 @@ static LIST_HEAD(, vdev_netvsc_ctx) vdev_netvsc_ctx_list =
vdev_netvsc_cmp_rte_device(const struct rte_device *dev1,
__rte_unused const void *_dev2)
{
- return strcmp(dev1->devargs->name, VDEV_NETVSC_DRIVER_NAME);
+ return strncmp(dev1->devargs->name, VDEV_NETVSC_DRIVER_NAME,
+ VDEV_NETVSC_DRIVER_NAME_LEN);
}
/**
@@ -814,7 +816,8 @@ static LIST_HEAD(, vdev_netvsc_ctx) vdev_netvsc_ctx_list =
struct rte_bus *vbus = rte_bus_find_by_name("vdev");
RTE_EAL_DEVARGS_FOREACH("vdev", devargs)
- if (!strcmp(devargs->name, VDEV_NETVSC_DRIVER_NAME))
+ if (!strncmp(devargs->name, VDEV_NETVSC_DRIVER_NAME,
+ VDEV_NETVSC_DRIVER_NAME_LEN))
return;
dev = (struct rte_vdev_device *)vbus->find_device(NULL,
vdev_netvsc_cmp_rte_device, VDEV_NETVSC_DRIVER_NAME);
--
1.9.5
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-stable] [dpdk-dev] [PATCH] net/vdev_netvsc: fix automatic probing
2018-05-21 16:23 [dpdk-stable] [PATCH] net/vdev_netvsc: fix automatic probing Matan Azrad
@ 2018-05-21 16:52 ` Stephen Hemminger
2018-05-21 17:25 ` Matan Azrad
2018-05-22 9:57 ` [dpdk-stable] " Ferruh Yigit
1 sibling, 1 reply; 4+ messages in thread
From: Stephen Hemminger @ 2018-05-21 16:52 UTC (permalink / raw)
To: Matan Azrad; +Cc: dev, Ferruh Yigit, stable
On Mon, 21 May 2018 16:23:30 +0000
Matan Azrad <matan@mellanox.com> wrote:
> The vdev_netvsc driver allows an automatic probe in Hyper-V VM systems
> unless it was already specified by the EAL command line.
>
> The detection of a specified NetVSC device is wrongly done by comparing
> the vdev_netvsc driver name to all the vdev devices names, including
> the suffix device index. Thus, if the user specifies the vdev_netvsc
> device by adding an index to the device name, the comparison fails.
> Consequently, the vdev_netvsc driver may automatically probe NetVSC
> devices, despite the NetVSC device that was specified by the EAL command
> line.
>
> Compare the vdev_netvsc driver name to the devices names without the
> index.
>
> Fixes: 56252de779a6 ("net/vdev_netvsc: add automatic probing")
> Cc: stable@dpdk.org
>
> Signed-off-by: Matan Azrad <matan@mellanox.com>
> ---
> drivers/net/vdev_netvsc/vdev_netvsc.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/vdev_netvsc/vdev_netvsc.c b/drivers/net/vdev_netvsc/vdev_netvsc.c
> index de2bd14..48717f2 100644
> --- a/drivers/net/vdev_netvsc/vdev_netvsc.c
> +++ b/drivers/net/vdev_netvsc/vdev_netvsc.c
> @@ -39,6 +39,7 @@
>
> #define VDEV_NETVSC_DRIVER net_vdev_netvsc
> #define VDEV_NETVSC_DRIVER_NAME RTE_STR(VDEV_NETVSC_DRIVER)
> +#define VDEV_NETVSC_DRIVER_NAME_LEN 15
Looks correct, why did you not just use IFNAMSIZ which is commonly used
across much of the network code?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-stable] [dpdk-dev] [PATCH] net/vdev_netvsc: fix automatic probing
2018-05-21 16:52 ` [dpdk-stable] [dpdk-dev] " Stephen Hemminger
@ 2018-05-21 17:25 ` Matan Azrad
0 siblings, 0 replies; 4+ messages in thread
From: Matan Azrad @ 2018-05-21 17:25 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: dev, Ferruh Yigit, stable
From: Stephen Hemminger
> On Mon, 21 May 2018 16:23:30 +0000
> Matan Azrad <matan@mellanox.com> wrote:
>
> > The vdev_netvsc driver allows an automatic probe in Hyper-V VM systems
> > unless it was already specified by the EAL command line.
> >
> > The detection of a specified NetVSC device is wrongly done by
> > comparing the vdev_netvsc driver name to all the vdev devices names,
> > including the suffix device index. Thus, if the user specifies the
> > vdev_netvsc device by adding an index to the device name, the comparison
> fails.
> > Consequently, the vdev_netvsc driver may automatically probe NetVSC
> > devices, despite the NetVSC device that was specified by the EAL
> > command line.
> >
> > Compare the vdev_netvsc driver name to the devices names without the
> > index.
> >
> > Fixes: 56252de779a6 ("net/vdev_netvsc: add automatic probing")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Matan Azrad <matan@mellanox.com>
> > ---
> > drivers/net/vdev_netvsc/vdev_netvsc.c | 7 +++++--
> > 1 file changed, 5 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/net/vdev_netvsc/vdev_netvsc.c
> > b/drivers/net/vdev_netvsc/vdev_netvsc.c
> > index de2bd14..48717f2 100644
> > --- a/drivers/net/vdev_netvsc/vdev_netvsc.c
> > +++ b/drivers/net/vdev_netvsc/vdev_netvsc.c
> > @@ -39,6 +39,7 @@
> >
> > #define VDEV_NETVSC_DRIVER net_vdev_netvsc #define
> > VDEV_NETVSC_DRIVER_NAME RTE_STR(VDEV_NETVSC_DRIVER)
> > +#define VDEV_NETVSC_DRIVER_NAME_LEN 15
>
> Looks correct, why did you not just use IFNAMSIZ which is commonly used
> across much of the network code?
Actually this is the driver name size (without \0) no an interface name.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-stable] [PATCH] net/vdev_netvsc: fix automatic probing
2018-05-21 16:23 [dpdk-stable] [PATCH] net/vdev_netvsc: fix automatic probing Matan Azrad
2018-05-21 16:52 ` [dpdk-stable] [dpdk-dev] " Stephen Hemminger
@ 2018-05-22 9:57 ` Ferruh Yigit
1 sibling, 0 replies; 4+ messages in thread
From: Ferruh Yigit @ 2018-05-22 9:57 UTC (permalink / raw)
To: Matan Azrad, dev; +Cc: stable
On 5/21/2018 5:23 PM, Matan Azrad wrote:
> The vdev_netvsc driver allows an automatic probe in Hyper-V VM systems
> unless it was already specified by the EAL command line.
>
> The detection of a specified NetVSC device is wrongly done by comparing
> the vdev_netvsc driver name to all the vdev devices names, including
> the suffix device index. Thus, if the user specifies the vdev_netvsc
> device by adding an index to the device name, the comparison fails.
> Consequently, the vdev_netvsc driver may automatically probe NetVSC
> devices, despite the NetVSC device that was specified by the EAL command
> line.
>
> Compare the vdev_netvsc driver name to the devices names without the
> index.
>
> Fixes: 56252de779a6 ("net/vdev_netvsc: add automatic probing")
> Cc: stable@dpdk.org
>
> Signed-off-by: Matan Azrad <matan@mellanox.com>
Applied to dpdk-next-net/master, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-05-22 9:57 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-21 16:23 [dpdk-stable] [PATCH] net/vdev_netvsc: fix automatic probing Matan Azrad
2018-05-21 16:52 ` [dpdk-stable] [dpdk-dev] " Stephen Hemminger
2018-05-21 17:25 ` Matan Azrad
2018-05-22 9:57 ` [dpdk-stable] " Ferruh Yigit
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).