DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v5] net/failsafe: fix probe cleanup
@ 2018-05-09 15:57 Raslan Darawsheh
  2018-05-09 22:55 ` [dpdk-dev] [dpdk-stable] " Ferruh Yigit
  0 siblings, 1 reply; 2+ messages in thread
From: Raslan Darawsheh @ 2018-05-09 15:57 UTC (permalink / raw)
  To: gaetan.rivet; +Cc: dev, matan, thomas, ophirmu, rasland, stable

The hot-plug alarm mechanism is responsible to practically execute both
plug in and out operations. It periodically tries to detect missed
sub-devices to be reconfigured and clean the resources of the removed
sub-devices.

The hot-plug alarm is started by the failsafe probe function, and it's
wrongly not stopped if failsafe instance got an error. for example
when starting failsafe with a MAC option, and giving it an invalid MAC
address this will lead to a NULL pointer for the dev private field. Then
when the hotplug alarm is called it will try to access this pointer,
which will lead to a segmentation fault.

Uninstall the hot-plug alarm in case of error in probe function.

Fixes: ebea83f8 ("net/failsafe: add plug-in support")
Cc: stable@dpdk.org

Signed-off-by: Raslan Darawsheh <rasland@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
Acked-by: Gaetan Rivet <gaetan.rivet@6wind.com>
---
v2 changes:
 Reword the commit log.

v3 changes:
 Reword the commit log.

v4 changes:
 Fix the fixes commit sha and title.

v5 changes:
 added right Acked-by tags.
---
---
 drivers/net/failsafe/failsafe.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/failsafe/failsafe.c b/drivers/net/failsafe/failsafe.c
index 5e7a8ba..3a747c2 100644
--- a/drivers/net/failsafe/failsafe.c
+++ b/drivers/net/failsafe/failsafe.c
@@ -226,7 +226,7 @@ fs_eth_dev_create(struct rte_vdev_device *vdev)
 							       mac);
 			if (ret) {
 				ERROR("Failed to set default MAC address");
-				goto free_args;
+				goto cancel_alarm;
 			}
 		}
 	} else {
@@ -260,6 +260,8 @@ fs_eth_dev_create(struct rte_vdev_device *vdev)
 		.type = RTE_INTR_HANDLE_EXT,
 	};
 	return 0;
+cancel_alarm:
+	failsafe_hotplug_alarm_cancel(dev);
 free_args:
 	failsafe_args_free(dev);
 free_subs:
-- 
2.7.4

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

* Re: [dpdk-dev] [dpdk-stable] [PATCH v5] net/failsafe: fix probe cleanup
  2018-05-09 15:57 [dpdk-dev] [PATCH v5] net/failsafe: fix probe cleanup Raslan Darawsheh
@ 2018-05-09 22:55 ` Ferruh Yigit
  0 siblings, 0 replies; 2+ messages in thread
From: Ferruh Yigit @ 2018-05-09 22:55 UTC (permalink / raw)
  To: Raslan Darawsheh, gaetan.rivet; +Cc: dev, matan, thomas, ophirmu, stable

On 5/9/2018 4:57 PM, Raslan Darawsheh wrote:
> The hot-plug alarm mechanism is responsible to practically execute both
> plug in and out operations. It periodically tries to detect missed
> sub-devices to be reconfigured and clean the resources of the removed
> sub-devices.
> 
> The hot-plug alarm is started by the failsafe probe function, and it's
> wrongly not stopped if failsafe instance got an error. for example
> when starting failsafe with a MAC option, and giving it an invalid MAC
> address this will lead to a NULL pointer for the dev private field. Then
> when the hotplug alarm is called it will try to access this pointer,
> which will lead to a segmentation fault.
> 
> Uninstall the hot-plug alarm in case of error in probe function.
> 
> Fixes: ebea83f8 ("net/failsafe: add plug-in support")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Raslan Darawsheh <rasland@mellanox.com>
> Acked-by: Matan Azrad <matan@mellanox.com>
> Acked-by: Gaetan Rivet <gaetan.rivet@6wind.com>

Applied to dpdk-next-net/master, thanks.

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

end of thread, other threads:[~2018-05-09 22:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-09 15:57 [dpdk-dev] [PATCH v5] net/failsafe: fix probe cleanup Raslan Darawsheh
2018-05-09 22:55 ` [dpdk-dev] [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).