DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] ethdev: Fix illegal access of rte_eth_dev_is_detachable()
@ 2015-08-07  9:21 Tetsuya Mukawa
  2015-08-07 10:38 ` Iremonger, Bernard
  0 siblings, 1 reply; 3+ messages in thread
From: Tetsuya Mukawa @ 2015-08-07  9:21 UTC (permalink / raw)
  To: dev

To obtain detachable flag, pci_drv is accessed in rte_eth_dev_is_detachable().
But pci_drv is only valid if port is enabled. Not to cause illegal access,
add rte_eth_dev_is_valid_port() before accessing.

Signed-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>
---
 lib/librte_ether/rte_ethdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 5fe1906..6b2400c 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -505,7 +505,7 @@ rte_eth_dev_is_detachable(uint8_t port_id)
 {
 	uint32_t drv_flags;
 
-	if (port_id >= RTE_MAX_ETHPORTS) {
+	if (!rte_eth_dev_is_valid_port(port_id)) {
 		PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
 		return -EINVAL;
 	}
-- 
2.1.4

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] ethdev: Fix illegal access of rte_eth_dev_is_detachable()
  2015-08-07  9:21 [dpdk-dev] [PATCH] ethdev: Fix illegal access of rte_eth_dev_is_detachable() Tetsuya Mukawa
@ 2015-08-07 10:38 ` Iremonger, Bernard
  2015-08-09 17:52   ` Thomas Monjalon
  0 siblings, 1 reply; 3+ messages in thread
From: Iremonger, Bernard @ 2015-08-07 10:38 UTC (permalink / raw)
  To: Tetsuya Mukawa, dev

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Tetsuya Mukawa
> Sent: Friday, August 7, 2015 10:21 AM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH] ethdev: Fix illegal access of
> rte_eth_dev_is_detachable()
> 
> To obtain detachable flag, pci_drv is accessed in
> rte_eth_dev_is_detachable().
> But pci_drv is only valid if port is enabled. Not to cause illegal access, add
> rte_eth_dev_is_valid_port() before accessing.
> 
> Signed-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>

Acked-by: Bernard Iremonger <Bernard.iremonger@intel.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] ethdev: Fix illegal access of rte_eth_dev_is_detachable()
  2015-08-07 10:38 ` Iremonger, Bernard
@ 2015-08-09 17:52   ` Thomas Monjalon
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Monjalon @ 2015-08-09 17:52 UTC (permalink / raw)
  To: Tetsuya Mukawa; +Cc: dev

> > To obtain detachable flag, pci_drv is accessed in
> > rte_eth_dev_is_detachable().
> > But pci_drv is only valid if port is enabled. Not to cause illegal access, add
> > rte_eth_dev_is_valid_port() before accessing.
> > 
> > Signed-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>
> 
> Acked-by: Bernard Iremonger <Bernard.iremonger@intel.com>

Applied, thanks

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-08-09 17:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-07  9:21 [dpdk-dev] [PATCH] ethdev: Fix illegal access of rte_eth_dev_is_detachable() Tetsuya Mukawa
2015-08-07 10:38 ` Iremonger, Bernard
2015-08-09 17:52   ` Thomas Monjalon

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).