[2/2] app/testpmd: fix invalid port detaching
diff mbox series

Message ID 1573548459-6931-2-git-send-email-matan@mellanox.com
State Accepted, archived
Delegated to: David Marchand
Headers show
Series
  • [1/2] bus/pci: fix driver detach clear
Related show

Checks

Context Check Description
ci/Intel-compilation success Compilation OK
ci/travis-robot success Travis build: passed
ci/checkpatch success coding style OK

Commit Message

Matan Azrad Nov. 12, 2019, 8:47 a.m. UTC
The port was not validated before detaching.

Ignore port detach operation when the port is not valid.

Fixes: f8e5baa2662d ("app/testpmd: check not detaching device twice")
Cc: thomas@monjalon.net
Cc: stable@dpdk.org

Signed-off-by: Matan Azrad <matan@mellanox.com>
---
 app/test-pmd/testpmd.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Iremonger, Bernard Nov. 12, 2019, 11:20 a.m. UTC | #1
> -----Original Message-----
> From: Matan Azrad <matan@mellanox.com>
> Sent: Tuesday, November 12, 2019 8:48 AM
> To: dev@dpdk.org
> Cc: Gaetan Rivet <gaetan.rivet@6wind.com>; Iremonger, Bernard
> <bernard.iremonger@intel.com>; thomas@monjalon.net; stable@dpdk.org
> Subject: [PATCH 2/2] app/testpmd: fix invalid port detaching
> 
> The port was not validated before detaching.
> 
> Ignore port detach operation when the port is not valid.
> 
> Fixes: f8e5baa2662d ("app/testpmd: check not detaching device twice")
> Cc: thomas@monjalon.net
> Cc: stable@dpdk.org
> 
> Signed-off-by: Matan Azrad <matan@mellanox.com>

Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
David Marchand Nov. 20, 2019, 10:52 p.m. UTC | #2
On Tue, Nov 12, 2019 at 12:21 PM Iremonger, Bernard
<bernard.iremonger@intel.com> wrote:
>
> > -----Original Message-----
> > From: Matan Azrad <matan@mellanox.com>
> > Sent: Tuesday, November 12, 2019 8:48 AM
> > To: dev@dpdk.org
> > Cc: Gaetan Rivet <gaetan.rivet@6wind.com>; Iremonger, Bernard
> > <bernard.iremonger@intel.com>; thomas@monjalon.net; stable@dpdk.org
> > Subject: [PATCH 2/2] app/testpmd: fix invalid port detaching
> >
> > The port was not validated before detaching.
> >
> > Ignore port detach operation when the port is not valid.
> >
> > Fixes: f8e5baa2662d ("app/testpmd: check not detaching device twice")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Matan Azrad <matan@mellanox.com>
>
> Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
>

Applied, thanks.



--
David Marchand

Patch
diff mbox series

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 4444346..370eefe 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -2545,6 +2545,9 @@  struct extmem_param {
 
 	printf("Removing a device...\n");
 
+	if (port_id_is_invalid(port_id, ENABLED_WARN))
+		return;
+
 	dev = rte_eth_devices[port_id].device;
 	if (dev == NULL) {
 		printf("Device already removed\n");