Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Bogendoerfer <tbogendoerfer@suse.de>2019-11-05 14:08:48 +0100
committerThomas Bogendoerfer <tbogendoerfer@suse.de>2019-11-05 14:09:53 +0100
commit60a826707d528b241f7eae1c452ccd84f0832bf9 (patch)
tree1e8d5021d9b03271018375511cf6914c45f461f9
parente9201f07dd7b9afc6565463163a333fe5470442f (diff)
mlxsw: core: Unpublish devlink parameters during reload
(bsc#1154488).
-rw-r--r--patches.suse/mlxsw-core-Unpublish-devlink-parameters-during-reloa.patch51
-rw-r--r--series.conf1
2 files changed, 52 insertions, 0 deletions
diff --git a/patches.suse/mlxsw-core-Unpublish-devlink-parameters-during-reloa.patch b/patches.suse/mlxsw-core-Unpublish-devlink-parameters-during-reloa.patch
new file mode 100644
index 0000000000..027254e057
--- /dev/null
+++ b/patches.suse/mlxsw-core-Unpublish-devlink-parameters-during-reloa.patch
@@ -0,0 +1,51 @@
+From: Jiri Pirko <jiri@mellanox.com>
+Date: Wed, 30 Oct 2019 11:04:22 +0200
+Subject: mlxsw: core: Unpublish devlink parameters during reload
+Patch-mainline: v5.4-rc6
+Git-commit: b7265a0df82c1716bf788096217083ed65a8bb14
+References: bsc#1154488
+
+The devlink parameter "acl_region_rehash_interval" is a runtime
+parameter whose value is stored in a dynamically allocated memory. While
+reloading the driver, this memory is freed and then allocated again. A
+use-after-free might happen if during this time frame someone tries to
+retrieve its value.
+
+Since commit 070c63f20f6c ("net: devlink: allow to change namespaces
+during reload") the use-after-free can be reliably triggered when
+reloading the driver into a namespace, as after freeing the memory (via
+reload_down() callback) all the parameters are notified.
+
+Fix this by unpublishing and then re-publishing the parameters during
+reload.
+
+Fixes: 98bbf70c1c41 ("mlxsw: spectrum: add "acl_region_rehash_interval" devlink param")
+Fixes: 7c62cfb8c574 ("devlink: publish params only after driver init is done")
+Signed-off-by: Jiri Pirko <jiri@mellanox.com>
+Signed-off-by: Ido Schimmel <idosch@mellanox.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/net/ethernet/mellanox/mlxsw/core.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/drivers/net/ethernet/mellanox/mlxsw/core.c
++++ b/drivers/net/ethernet/mellanox/mlxsw/core.c
+@@ -1186,7 +1186,7 @@ __mlxsw_core_bus_device_register(const s
+ if (err)
+ goto err_thermal_init;
+
+- if (mlxsw_driver->params_register && !reload)
++ if (mlxsw_driver->params_register)
+ devlink_params_publish(devlink);
+
+ return 0;
+@@ -1259,7 +1259,7 @@ void mlxsw_core_bus_device_unregister(st
+ return;
+ }
+
+- if (mlxsw_core->driver->params_unregister && !reload)
++ if (mlxsw_core->driver->params_unregister)
+ devlink_params_unpublish(devlink);
+ mlxsw_thermal_fini(mlxsw_core->thermal);
+ mlxsw_hwmon_fini(mlxsw_core->hwmon);
diff --git a/series.conf b/series.conf
index ce89741a3f..180ebe369e 100644
--- a/series.conf
+++ b/series.conf
@@ -2884,6 +2884,7 @@
patches.suse/qed-fix-spelling-mistake-queuess-queues.patch
patches.suse/vxlan-fix-unexpected-failure-of-vxlan_changelink.patch
patches.suse/qed-Optimize-execution-time-for-nvm-attributes-confi.patch
+ patches.suse/mlxsw-core-Unpublish-devlink-parameters-during-reloa.patch
patches.suse/powerpc-powernv-Fix-CPU-idle-to-be-called-with-IRQs-.patch
patches.suse/scsi-qla2xxx-fixup-incorrect-usage-of-host_byte.patch
patches.suse/scsi-lpfc-Check-queue-pointer-before-use.patch