Parcourir la source

qcacmn: Ignore destroy callback if creating fail

objmgr should not call destroy callbacks for components
that have not successfully completed the creating callback.
Or the function wlan_objmgr_xxx_obj_destroy returns with
QDF_STATUS_E_FAILURE and doesn't call wlan_objmgr_xxx_obj_free
to free the psoc/pdev/vdev/peer.

Change-Id: I1ba5a6afd98254cbed4571d5fb1cd24543e1db54
CRs-Fixed: 2318184
Paul Zhang il y a 6 ans
Parent
commit
da522d8f7c

+ 3 - 1
umac/cmn_services/obj_mgr/src/wlan_objmgr_pdev_obj.c

@@ -207,7 +207,9 @@ static QDF_STATUS wlan_objmgr_pdev_obj_destroy(struct wlan_objmgr_pdev *pdev)
 	for (id = 0; id < WLAN_UMAC_MAX_COMPONENTS; id++) {
 		handler = g_umac_glb_obj->pdev_destroy_handler[id];
 		arg = g_umac_glb_obj->pdev_destroy_handler_arg[id];
-		if (handler != NULL)
+		if (handler &&
+		    (pdev->obj_status[id] == QDF_STATUS_SUCCESS ||
+		     pdev->obj_status[id] == QDF_STATUS_COMP_ASYNC))
 			pdev->obj_status[id] = handler(pdev, arg);
 		else
 			pdev->obj_status[id] = QDF_STATUS_COMP_DISABLED;

+ 3 - 1
umac/cmn_services/obj_mgr/src/wlan_objmgr_peer_obj.c

@@ -303,7 +303,9 @@ static QDF_STATUS wlan_objmgr_peer_obj_destroy(struct wlan_objmgr_peer *peer)
 	for (id = 0; id < WLAN_UMAC_MAX_COMPONENTS; id++) {
 		handler = g_umac_glb_obj->peer_destroy_handler[id];
 		arg = g_umac_glb_obj->peer_destroy_handler_arg[id];
-		if (handler != NULL)
+		if (handler &&
+		    (peer->obj_status[id] == QDF_STATUS_SUCCESS ||
+		     peer->obj_status[id] == QDF_STATUS_COMP_ASYNC))
 			peer->obj_status[id] = handler(peer, arg);
 		else
 			peer->obj_status[id] = QDF_STATUS_COMP_DISABLED;

+ 3 - 1
umac/cmn_services/obj_mgr/src/wlan_objmgr_psoc_obj.c

@@ -215,7 +215,9 @@ static QDF_STATUS wlan_objmgr_psoc_obj_destroy(struct wlan_objmgr_psoc *psoc)
 	for (id = 0; id < WLAN_UMAC_MAX_COMPONENTS; id++) {
 		handler = g_umac_glb_obj->psoc_destroy_handler[id];
 		arg = g_umac_glb_obj->psoc_destroy_handler_arg[id];
-		if (handler != NULL)
+		if (handler &&
+		    (psoc->obj_status[id] == QDF_STATUS_SUCCESS ||
+		     psoc->obj_status[id] == QDF_STATUS_COMP_ASYNC))
 			psoc->obj_status[id] = handler(psoc, arg);
 		else
 			psoc->obj_status[id] = QDF_STATUS_COMP_DISABLED;

+ 3 - 1
umac/cmn_services/obj_mgr/src/wlan_objmgr_vdev_obj.c

@@ -293,7 +293,9 @@ static QDF_STATUS wlan_objmgr_vdev_obj_destroy(struct wlan_objmgr_vdev *vdev)
 	for (id = 0; id < WLAN_UMAC_MAX_COMPONENTS; id++) {
 		handler = g_umac_glb_obj->vdev_destroy_handler[id];
 		arg = g_umac_glb_obj->vdev_destroy_handler_arg[id];
-		if (handler != NULL)
+		if (handler &&
+		    (vdev->obj_status[id] == QDF_STATUS_SUCCESS ||
+		     vdev->obj_status[id] == QDF_STATUS_COMP_ASYNC))
 			vdev->obj_status[id] = handler(vdev, arg);
 		else
 			vdev->obj_status[id] = QDF_STATUS_COMP_DISABLED;