Przeglądaj źródła

Merge "qcacld-3.0: Check for null before taking the DSC lock" into wlan-cld3.driver.lnx.2.0

CNSS_WLAN Service 6 lat temu
rodzic
commit
8a72cafe37

+ 30 - 12
components/dsc/src/wlan_dsc_driver.c

@@ -252,43 +252,63 @@ static void __dsc_driver_trans_stop(struct dsc_driver *driver)
 	if (!dsc_assert(driver))
 		return;
 
+	__dsc_lock(driver);
+
 	dsc_assert(driver->trans.active_desc);
 	driver->trans.active_desc = NULL;
-
 	__dsc_driver_trigger_trans(driver);
+
+	__dsc_unlock(driver);
 }
 
 void dsc_driver_trans_stop(struct dsc_driver *driver)
 {
 	dsc_enter();
-	__dsc_lock(driver);
 	__dsc_driver_trans_stop(driver);
-	__dsc_unlock(driver);
 	dsc_exit();
 }
 
-void dsc_driver_trans_assert(struct dsc_driver *driver)
+static void __dsc_driver_trans_assert(struct dsc_driver *driver)
 {
-	dsc_enter();
+	if (!dsc_assert(driver))
+		return;
+
 	__dsc_lock(driver);
 	dsc_assert(driver->trans.active_desc);
 	__dsc_unlock(driver);
+}
+
+void dsc_driver_trans_assert(struct dsc_driver *driver)
+{
+	dsc_enter();
+	__dsc_driver_trans_assert(driver);
 	dsc_exit();
 }
 
 static QDF_STATUS
 __dsc_driver_op_start(struct dsc_driver *driver, const char *func)
 {
+	QDF_STATUS status;
+
 	if (!dsc_assert(driver))
 		return QDF_STATUS_E_INVAL;
 
 	if (!dsc_assert(func))
 		return QDF_STATUS_E_INVAL;
 
-	if (!__dsc_driver_can_op(driver))
-		return QDF_STATUS_E_AGAIN;
+	__dsc_lock(driver);
+
+	if (!__dsc_driver_can_op(driver)) {
+		status = QDF_STATUS_E_AGAIN;
+		goto unlock;
+	}
+
+	status = __dsc_ops_insert(&driver->ops, func);
+
+unlock:
+	__dsc_unlock(driver);
 
-	return __dsc_ops_insert(&driver->ops, func);
+	return status;
 }
 
 QDF_STATUS _dsc_driver_op_start(struct dsc_driver *driver, const char *func)
@@ -296,9 +316,7 @@ QDF_STATUS _dsc_driver_op_start(struct dsc_driver *driver, const char *func)
 	QDF_STATUS status;
 
 	dsc_enter_str(func);
-	__dsc_lock(driver);
 	status = __dsc_driver_op_start(driver, func);
-	__dsc_unlock(driver);
 	dsc_exit_status(status);
 
 	return status;
@@ -312,16 +330,16 @@ static void __dsc_driver_op_stop(struct dsc_driver *driver, const char *func)
 	if (!dsc_assert(func))
 		return;
 
+	__dsc_lock(driver);
 	if (__dsc_ops_remove(&driver->ops, func))
 		qdf_event_set(&driver->ops.event);
+	__dsc_unlock(driver);
 }
 
 void _dsc_driver_op_stop(struct dsc_driver *driver, const char *func)
 {
 	dsc_enter_str(func);
-	__dsc_lock(driver);
 	__dsc_driver_op_stop(driver, func);
-	__dsc_unlock(driver);
 	dsc_exit();
 }
 

+ 30 - 12
components/dsc/src/wlan_dsc_psoc.c

@@ -241,27 +241,36 @@ static void __dsc_psoc_trans_stop(struct dsc_psoc *psoc)
 	if (!dsc_assert(psoc))
 		return;
 
+	__dsc_driver_lock(psoc);
+
 	dsc_assert(psoc->trans.active_desc);
 	psoc->trans.active_desc = NULL;
-
 	__dsc_psoc_trigger_trans(psoc);
+
+	__dsc_driver_unlock(psoc);
 }
 
 void dsc_psoc_trans_stop(struct dsc_psoc *psoc)
 {
 	dsc_enter();
-	__dsc_driver_lock(psoc);
 	__dsc_psoc_trans_stop(psoc);
-	__dsc_driver_unlock(psoc);
 	dsc_exit();
 }
 
-void dsc_psoc_trans_assert(struct dsc_psoc *psoc)
+static void __dsc_psoc_trans_assert(struct dsc_psoc *psoc)
 {
-	dsc_enter();
+	if (!dsc_assert(psoc))
+		return;
+
 	__dsc_driver_lock(psoc);
 	dsc_assert(psoc->trans.active_desc);
 	__dsc_driver_unlock(psoc);
+}
+
+void dsc_psoc_trans_assert(struct dsc_psoc *psoc)
+{
+	dsc_enter();
+	__dsc_psoc_trans_assert(psoc);
 	dsc_exit();
 }
 
@@ -279,16 +288,27 @@ bool __dsc_psoc_trans_trigger_checked(struct dsc_psoc *psoc)
 
 static QDF_STATUS __dsc_psoc_op_start(struct dsc_psoc *psoc, const char *func)
 {
+	QDF_STATUS status;
+
 	if (!dsc_assert(psoc))
 		return QDF_STATUS_E_INVAL;
 
 	if (!dsc_assert(func))
 		return QDF_STATUS_E_INVAL;
 
-	if (!__dsc_psoc_can_op(psoc))
-		return QDF_STATUS_E_AGAIN;
+	__dsc_driver_lock(psoc);
+
+	if (!__dsc_psoc_can_op(psoc)) {
+		status = QDF_STATUS_E_AGAIN;
+		goto unlock;
+	}
+
+	status = __dsc_ops_insert(&psoc->ops, func);
+
+unlock:
+	__dsc_driver_unlock(psoc);
 
-	return __dsc_ops_insert(&psoc->ops, func);
+	return status;
 }
 
 QDF_STATUS _dsc_psoc_op_start(struct dsc_psoc *psoc, const char *func)
@@ -296,9 +316,7 @@ QDF_STATUS _dsc_psoc_op_start(struct dsc_psoc *psoc, const char *func)
 	QDF_STATUS status;
 
 	dsc_enter_str(func);
-	__dsc_driver_lock(psoc);
 	status = __dsc_psoc_op_start(psoc, func);
-	__dsc_driver_unlock(psoc);
 	dsc_exit_status(status);
 
 	return status;
@@ -312,16 +330,16 @@ static void __dsc_psoc_op_stop(struct dsc_psoc *psoc, const char *func)
 	if (!dsc_assert(func))
 		return;
 
+	__dsc_driver_lock(psoc);
 	if (__dsc_ops_remove(&psoc->ops, func))
 		qdf_event_set(&psoc->ops.event);
+	__dsc_driver_unlock(psoc);
 }
 
 void _dsc_psoc_op_stop(struct dsc_psoc *psoc, const char *func)
 {
 	dsc_enter_str(func);
-	__dsc_driver_lock(psoc);
 	__dsc_psoc_op_stop(psoc, func);
-	__dsc_driver_unlock(psoc);
 	dsc_exit();
 }
 

+ 30 - 12
components/dsc/src/wlan_dsc_vdev.c

@@ -212,42 +212,62 @@ static void __dsc_vdev_trans_stop(struct dsc_vdev *vdev)
 	if (!dsc_assert(vdev))
 		return;
 
+	__dsc_driver_lock(vdev);
+
 	dsc_assert(vdev->trans.active_desc);
 	vdev->trans.active_desc = NULL;
-
 	__dsc_vdev_trigger_trans(vdev);
+
+	__dsc_driver_unlock(vdev);
 }
 
 void dsc_vdev_trans_stop(struct dsc_vdev *vdev)
 {
 	dsc_enter();
-	__dsc_driver_lock(vdev);
 	__dsc_vdev_trans_stop(vdev);
-	__dsc_driver_unlock(vdev);
 	dsc_exit();
 }
 
-void dsc_vdev_trans_assert(struct dsc_vdev *vdev)
+static void __dsc_vdev_trans_assert(struct dsc_vdev *vdev)
 {
-	dsc_enter();
+	if (!dsc_assert(vdev))
+		return;
+
 	__dsc_driver_lock(vdev);
 	dsc_assert(vdev->trans.active_desc);
 	__dsc_driver_unlock(vdev);
+}
+
+void dsc_vdev_trans_assert(struct dsc_vdev *vdev)
+{
+	dsc_enter();
+	__dsc_vdev_trans_assert(vdev);
 	dsc_exit();
 }
 
 static QDF_STATUS __dsc_vdev_op_start(struct dsc_vdev *vdev, const char *func)
 {
+	QDF_STATUS status;
+
 	if (!dsc_assert(vdev))
 		return QDF_STATUS_E_INVAL;
 
 	if (!dsc_assert(func))
 		return QDF_STATUS_E_INVAL;
 
-	if (!__dsc_vdev_can_op(vdev))
-		return QDF_STATUS_E_AGAIN;
+	__dsc_driver_lock(vdev);
+
+	if (!__dsc_vdev_can_op(vdev)) {
+		status = QDF_STATUS_E_AGAIN;
+		goto unlock;
+	}
+
+	status = __dsc_ops_insert(&vdev->ops, func);
+
+unlock:
+	__dsc_driver_unlock(vdev);
 
-	return __dsc_ops_insert(&vdev->ops, func);
+	return status;
 }
 
 QDF_STATUS _dsc_vdev_op_start(struct dsc_vdev *vdev, const char *func)
@@ -255,9 +275,7 @@ QDF_STATUS _dsc_vdev_op_start(struct dsc_vdev *vdev, const char *func)
 	QDF_STATUS status;
 
 	dsc_enter_str(func);
-	__dsc_driver_lock(vdev);
 	status = __dsc_vdev_op_start(vdev, func);
-	__dsc_driver_unlock(vdev);
 	dsc_exit_status(status);
 
 	return status;
@@ -271,16 +289,16 @@ static void __dsc_vdev_op_stop(struct dsc_vdev *vdev, const char *func)
 	if (!dsc_assert(func))
 		return;
 
+	__dsc_driver_lock(vdev);
 	if (__dsc_ops_remove(&vdev->ops, func))
 		qdf_event_set(&vdev->ops.event);
+	__dsc_driver_unlock(vdev);
 }
 
 void _dsc_vdev_op_stop(struct dsc_vdev *vdev, const char *func)
 {
 	dsc_enter_str(func);
-	__dsc_driver_lock(vdev);
 	__dsc_vdev_op_stop(vdev, func);
-	__dsc_driver_unlock(vdev);
 	dsc_exit();
 }