Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPetr Tesarik <ptesarik@suse.cz>2019-03-22 10:39:25 +0100
committerPetr Tesarik <ptesarik@suse.cz>2019-04-04 13:29:03 +0200
commit046c37d6492c8a6ef68d873143e604d02735c0e0 (patch)
treeeb38d80e84f86c1906f9c1268c07e5719c0ea85d
parentae5cd8e277abdf9b46c136219719dc62486b28f4 (diff)
net/smc: check port_idx of ib event (bsc#1129861 LTC#176250).
-rw-r--r--patches.fixes/net-smc-check-port_idx-of-ib-event69
-rw-r--r--series.conf1
2 files changed, 70 insertions, 0 deletions
diff --git a/patches.fixes/net-smc-check-port_idx-of-ib-event b/patches.fixes/net-smc-check-port_idx-of-ib-event
new file mode 100644
index 0000000000..4cef304198
--- /dev/null
+++ b/patches.fixes/net-smc-check-port_idx-of-ib-event
@@ -0,0 +1,69 @@
+From: Karsten Graul <kgraul@linux.ibm.com>
+Date: Tue, 12 Feb 2019 16:29:55 +0100
+Subject: net/smc: check port_idx of ib event
+Git-commit: 81cf6430526531bc688d4c3d09506dba7b456fb1
+Patch-mainline: v5.1-rc1
+References: bsc#1129861 LTC#176250
+
+For robustness protect of higher port numbers than expected to avoid
+setting bits behind our port_event_mask. In case of an DEVICE_FATAL
+event all ports must be checked. The IB_EVENT_GID_CHANGE event is
+provided in the global event handler, so handle it there. And handle a
+QP_FATAL event instead of an DEVICE_FATAL event in the qp handler.
+
+Signed-off-by: Karsten Graul <kgraul@linux.ibm.com>
+Signed-off-by: Ursula Braun <ubraun@linux.ibm.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Acked-by: Petr Tesarik <ptesarik@suse.com>
+---
+ net/smc/smc_ib.c | 24 ++++++++++++++++--------
+ 1 file changed, 16 insertions(+), 8 deletions(-)
+
+diff --git a/net/smc/smc_ib.c b/net/smc/smc_ib.c
+index 76487a16934e..0b244be24fe0 100644
+--- a/net/smc/smc_ib.c
++++ b/net/smc/smc_ib.c
+@@ -257,12 +257,20 @@ static void smc_ib_global_event_handler(struct ib_event_handler *handler,
+ smcibdev = container_of(handler, struct smc_ib_device, event_handler);
+
+ switch (ibevent->event) {
+- case IB_EVENT_PORT_ERR:
+ case IB_EVENT_DEVICE_FATAL:
++ /* terminate all ports on device */
++ for (port_idx = 0; port_idx < SMC_MAX_PORTS; port_idx++)
++ set_bit(port_idx, &smcibdev->port_event_mask);
++ schedule_work(&smcibdev->port_event_work);
++ break;
++ case IB_EVENT_PORT_ERR:
+ case IB_EVENT_PORT_ACTIVE:
++ case IB_EVENT_GID_CHANGE:
+ port_idx = ibevent->element.port_num - 1;
+- set_bit(port_idx, &smcibdev->port_event_mask);
+- schedule_work(&smcibdev->port_event_work);
++ if (port_idx < SMC_MAX_PORTS) {
++ set_bit(port_idx, &smcibdev->port_event_mask);
++ schedule_work(&smcibdev->port_event_work);
++ }
+ break;
+ default:
+ break;
+@@ -294,13 +302,13 @@ static void smc_ib_qp_event_handler(struct ib_event *ibevent, void *priv)
+ u8 port_idx;
+
+ switch (ibevent->event) {
+- case IB_EVENT_DEVICE_FATAL:
+- case IB_EVENT_GID_CHANGE:
+- case IB_EVENT_PORT_ERR:
++ case IB_EVENT_QP_FATAL:
+ case IB_EVENT_QP_ACCESS_ERR:
+ port_idx = ibevent->element.qp->port - 1;
+- set_bit(port_idx, &smcibdev->port_event_mask);
+- schedule_work(&smcibdev->port_event_work);
++ if (port_idx < SMC_MAX_PORTS) {
++ set_bit(port_idx, &smcibdev->port_event_mask);
++ schedule_work(&smcibdev->port_event_work);
++ }
+ break;
+ default:
+ break;
+
diff --git a/series.conf b/series.conf
index 17852b11d3..dfedbf0a8b 100644
--- a/series.conf
+++ b/series.conf
@@ -44437,6 +44437,7 @@
patches.fixes/net-smc-no-delay-for-free-tx-buffer-wait
patches.fixes/net-smc-reduce-amount-of-status-updates-to-peer
patches.fixes/net-smc-check-connections-in-smc_lgr_free_work
+ patches.fixes/net-smc-check-port_idx-of-ib-event
patches.drivers/devlink-Return-right-error-code-in-case-of-errors-fo.patch
patches.drivers/devlink-Fix-list-access-without-lock-while-reading-r.patch
patches.drivers/cxgb4-cxgb4vf-Add-support-for-SGE-doorbell-queue-tim.patch