[ewg] [PATCH] RDMA/nes: fix hazard of sending ibevent for unregistered device

Maciej Sosnowski maciej.sosnowski at intel.com
Thu Jan 27 07:10:54 PST 2011


nes_port_ibevent() should not be called when nes IB device is not registered with IB core.
Add missing checks of of_device_registered flag.

Signed-off-by: Maciej Sosnowski <maciej.sosnowski at intel.com>
---

 .../fixes/nes_0056_port_ibevent_fix.patch          |   64 +++++++++++++++++++++++
 1 files changed, 64 insertions(+), 0 deletions(-)

diff --git a/kernel_patches/fixes/nes_0056_port_ibevent_fix.patch b/kernel_patches/fixes/nes_0056_port_ibevent_fix.patch
new file mode 100644
index 0000000..a66bb8c
--- /dev/null
+++ b/kernel_patches/fixes/nes_0056_port_ibevent_fix.patch
@@ -0,0 +1,64 @@
+diff --git a/drivers/infiniband/hw/nes/nes_hw.c b/drivers/infiniband/hw/nes/nes_hw.c
+index 098d282..77fecbe 100644
+--- a/drivers/infiniband/hw/nes/nes_hw.c
++++ b/drivers/infiniband/hw/nes/nes_hw.c
+@@ -2609,9 +2609,11 @@ static void nes_process_mac_intr(struct 
+ 					netif_carrier_on(nesvnic->netdev);
+ 
+ 					spin_lock(&nesvnic->port_ibevent_lock);
+-					if (nesdev->iw_status == 0) {
+-						nesdev->iw_status = 1;
+-						nes_port_ibevent(nesvnic);
++					if (nesvnic->of_device_registered) {
++						if (nesdev->iw_status == 0) {
++							nesdev->iw_status = 1;
++							nes_port_ibevent(nesvnic);
++						}
+ 					}
+ 					spin_unlock(&nesvnic->port_ibevent_lock);
+ 				}
+@@ -2641,9 +2643,11 @@ static void nes_process_mac_intr(struct 
+ 					netif_carrier_off(nesvnic->netdev);
+ 
+ 					spin_lock(&nesvnic->port_ibevent_lock);
+-					if (nesdev->iw_status == 1) {
+-						nesdev->iw_status = 0;
+-						nes_port_ibevent(nesvnic);
++					if (nesvnic->of_device_registered) {
++						if (nesdev->iw_status == 1) {
++							nesdev->iw_status = 0;
++							nes_port_ibevent(nesvnic);
++						}
+ 					}
+ 					spin_unlock(&nesvnic->port_ibevent_lock);
+ 				}
+@@ -2702,9 +2706,11 @@ void nes_recheck_link_status(struct work
+ 				netif_carrier_on(nesvnic->netdev);
+ 
+ 				spin_lock(&nesvnic->port_ibevent_lock);
+-				if (nesdev->iw_status == 0) {
+-					nesdev->iw_status = 1;
+-					nes_port_ibevent(nesvnic);
++				if (nesvnic->of_device_registered) {
++					if (nesdev->iw_status == 0) {
++						nesdev->iw_status = 1;
++						nes_port_ibevent(nesvnic);
++					}
+ 				}
+ 				spin_unlock(&nesvnic->port_ibevent_lock);
+ 			}
+@@ -2722,9 +2728,11 @@ void nes_recheck_link_status(struct work
+ 				netif_carrier_off(nesvnic->netdev);
+ 
+ 				spin_lock(&nesvnic->port_ibevent_lock);
+-				if (nesdev->iw_status == 1) {
+-					nesdev->iw_status = 0;
+-					nes_port_ibevent(nesvnic);
++				if (nesvnic->of_device_registered) {
++					if (nesdev->iw_status == 1) {
++						nesdev->iw_status = 0;
++						nes_port_ibevent(nesvnic);
++					}
+ 				}
+ 				spin_unlock(&nesvnic->port_ibevent_lock);
+ 			}




More information about the ewg mailing list