DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/mlx5: fix crash when configure is not called
@ 2018-05-24 14:36 Adrien Mazarguil
  2018-05-24 18:21 ` Yongseok Koh
  0 siblings, 1 reply; 4+ messages in thread
From: Adrien Mazarguil @ 2018-05-24 14:36 UTC (permalink / raw)
  To: Shahaf Shuler; +Cc: dev, Yongseok Koh

Although uncommon, applications may destroy a device immediately after
probing it without going through dev_configure() first.

This patch addresses a crash which occurs when mlx5_dev_close() calls
mlx5_mr_release() due to an uninitialized entry in the private structure.

Fixes: 974f1e7ef146 ("net/mlx5: add new memory region support")
Cc: Yongseok Koh <yskoh@mellanox.com>

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
---
 drivers/net/mlx5/mlx5.c        | 7 +++++++
 drivers/net/mlx5/mlx5_ethdev.c | 4 ----
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 36d72f757..11b395b64 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -34,6 +34,8 @@
 #include <rte_config.h>
 #include <rte_eal_memconfig.h>
 #include <rte_kvargs.h>
+#include <rte_rwlock.h>
+#include <rte_spinlock.h>
 
 #include "mlx5.h"
 #include "mlx5_utils.h"
@@ -1145,6 +1147,11 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
 			goto port_error;
 		}
 		priv->config.max_verbs_prio = verb_priorities;
+		/* Add device to memory callback list. */
+		rte_rwlock_write_lock(&mlx5_shared_data->mem_event_rwlock);
+		LIST_INSERT_HEAD(&mlx5_shared_data->mem_event_cb_list,
+				 priv, mem_event_cb);
+		rte_rwlock_write_unlock(&mlx5_shared_data->mem_event_rwlock);
 		rte_eth_dev_probing_finish(eth_dev);
 		continue;
 port_error:
diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c
index c52ec6fb7..f6cebae41 100644
--- a/drivers/net/mlx5/mlx5_ethdev.c
+++ b/drivers/net/mlx5/mlx5_ethdev.c
@@ -403,10 +403,6 @@ mlx5_dev_configure(struct rte_eth_dev *dev)
 		/* rte_errno is already set. */
 		return -rte_errno;
 	}
-	rte_rwlock_write_lock(&mlx5_shared_data->mem_event_rwlock);
-	LIST_INSERT_HEAD(&mlx5_shared_data->mem_event_cb_list,
-			 priv, mem_event_cb);
-	rte_rwlock_write_unlock(&mlx5_shared_data->mem_event_rwlock);
 	return 0;
 }
 
-- 
2.11.0

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

* Re: [dpdk-dev] [PATCH] net/mlx5: fix crash when configure is not called
  2018-05-24 14:36 [dpdk-dev] [PATCH] net/mlx5: fix crash when configure is not called Adrien Mazarguil
@ 2018-05-24 18:21 ` Yongseok Koh
  2018-05-24 18:33   ` Yongseok Koh
  2018-05-27  5:04   ` Shahaf Shuler
  0 siblings, 2 replies; 4+ messages in thread
From: Yongseok Koh @ 2018-05-24 18:21 UTC (permalink / raw)
  To: Adrien Mazarguil; +Cc: Shahaf Shuler, dev, Xueming(Steven) Li


> On May 24, 2018, at 7:36 AM, Adrien Mazarguil <adrien.mazarguil@6wind.com> wrote:
> 
> Although uncommon, applications may destroy a device immediately after
> probing it without going through dev_configure() first.
> 
> This patch addresses a crash which occurs when mlx5_dev_close() calls
> mlx5_mr_release() due to an uninitialized entry in the private structure.
> 
> Fixes: 974f1e7ef146 ("net/mlx5: add new memory region support")
> Cc: Yongseok Koh <yskoh@mellanox.com>
> 
> Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
> ---
Acked-by: Yongseok Koh <yskoh@mellanox.com>
 
Thanks

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

* Re: [dpdk-dev] [PATCH] net/mlx5: fix crash when configure is not called
  2018-05-24 18:21 ` Yongseok Koh
@ 2018-05-24 18:33   ` Yongseok Koh
  2018-05-27  5:04   ` Shahaf Shuler
  1 sibling, 0 replies; 4+ messages in thread
From: Yongseok Koh @ 2018-05-24 18:33 UTC (permalink / raw)
  To: Adrien Mazarguil; +Cc: Shahaf Shuler, dev, Xueming(Steven) Li


> On May 24, 2018, at 11:21 AM, Yongseok Koh <yskoh@mellanox.com> wrote:
> 
> 
>> On May 24, 2018, at 7:36 AM, Adrien Mazarguil <adrien.mazarguil@6wind.com> wrote:
>> 
>> Although uncommon, applications may destroy a device immediately after
>> probing it without going through dev_configure() first.
>> 
>> This patch addresses a crash which occurs when mlx5_dev_close() calls
>> mlx5_mr_release() due to an uninitialized entry in the private structure.
>> 
>> Fixes: 974f1e7ef146 ("net/mlx5: add new memory region support")
>> Cc: Yongseok Koh <yskoh@mellanox.com>
>> 
>> Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
>> ---
> Acked-by: Yongseok Koh <yskoh@mellanox.com>

And you might want to write the same patch for mlx4.

Thanks,
Yongseok

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

* Re: [dpdk-dev] [PATCH] net/mlx5: fix crash when configure is not called
  2018-05-24 18:21 ` Yongseok Koh
  2018-05-24 18:33   ` Yongseok Koh
@ 2018-05-27  5:04   ` Shahaf Shuler
  1 sibling, 0 replies; 4+ messages in thread
From: Shahaf Shuler @ 2018-05-27  5:04 UTC (permalink / raw)
  To: Yongseok Koh, Adrien Mazarguil; +Cc: dev, Xueming(Steven) Li

Thursday, May 24, 2018 9:22 PM, Yongseok Koh:
> Subject: Re: [PATCH] net/mlx5: fix crash when configure is not called
> 
> 
> > On May 24, 2018, at 7:36 AM, Adrien Mazarguil
> <adrien.mazarguil@6wind.com> wrote:
> >
> > Although uncommon, applications may destroy a device immediately after
> > probing it without going through dev_configure() first.
> >
> > This patch addresses a crash which occurs when mlx5_dev_close() calls
> > mlx5_mr_release() due to an uninitialized entry in the private structure.
> >
> > Fixes: 974f1e7ef146 ("net/mlx5: add new memory region support")
> > Cc: Yongseok Koh <yskoh@mellanox.com>
> >
> > Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
> > ---
> Acked-by: Yongseok Koh <yskoh@mellanox.com>

Applied to next-net-mlx, thanks. 

> 
> Thanks

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

end of thread, other threads:[~2018-05-27  5:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-24 14:36 [dpdk-dev] [PATCH] net/mlx5: fix crash when configure is not called Adrien Mazarguil
2018-05-24 18:21 ` Yongseok Koh
2018-05-24 18:33   ` Yongseok Koh
2018-05-27  5:04   ` Shahaf Shuler

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