Bläddra i källkod

qcacld-3.0: Add NULL check for psoc_priv pointer

Add NULL check for psoc_priv pointer to avoid NULL pointer deference
in function pre_cac_handle_radar_ind() and pre_cac_handle_cac_end().

Change-Id: I07d0b98edb8e96d7803444bfd394d055a8b8d156
CRs-Fixed: 3625352
Huashan Qu 1 år sedan
förälder
incheckning
d41a5a9cd6
1 ändrade filer med 11 tillägg och 1 borttagningar
  1. 11 1
      components/pre_cac/core/src/wlan_pre_cac_main.c

+ 11 - 1
components/pre_cac/core/src/wlan_pre_cac_main.c

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2012-2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2021-2022, Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021-2023, Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -224,6 +224,11 @@ void pre_cac_handle_radar_ind(struct wlan_objmgr_vdev *vdev)
 	struct wlan_objmgr_psoc *psoc = wlan_vdev_get_psoc(vdev);
 	struct pre_cac_psoc_priv *psoc_priv = pre_cac_psoc_get_priv(psoc);
 
+	if (!psoc_priv) {
+		pre_cac_err("invalid psoc");
+		return;
+	}
+
 	pre_cac_conditional_csa_ind(psoc, wlan_vdev_get_id(vdev), false);
 
 	pre_cac_debug("schedue pre_cac_work vdev %d", wlan_vdev_get_id(vdev));
@@ -239,6 +244,11 @@ void pre_cac_handle_cac_end(struct wlan_objmgr_vdev *vdev)
 	struct wlan_objmgr_psoc *psoc = wlan_vdev_get_psoc(vdev);
 	struct pre_cac_psoc_priv *psoc_priv = pre_cac_psoc_get_priv(psoc);
 
+	if (!psoc_priv) {
+		pre_cac_err("invalid psoc");
+		return;
+	}
+
 	pre_cac_conditional_csa_ind(psoc, wlan_vdev_get_id(vdev), true);
 
 	pre_cac_debug("schedue pre_cac_work vdev %d", wlan_vdev_get_id(vdev));