qcacmn: Add NULL pointer check before dereferencing it

Few of the serialization APIs are de-referencing the pointer without
checking it against NULL.

Add a NULL check before de-referencing it.

CRs-Fixed: 2130161
Change-Id: I109518332e593e1f32936404021db1db7a332df7
This commit is contained in:
Krunal Soni
2017-10-20 11:37:43 -07:00
committed by snandini
parent 136dd82676
commit 80898349e8
2 changed files with 8 additions and 1 deletions

View File

@@ -219,6 +219,10 @@ wlan_serialization_request(struct wlan_serialization_command *cmd)
} }
ser_soc_obj = wlan_serialization_get_obj(cmd); ser_soc_obj = wlan_serialization_get_obj(cmd);
if (!ser_soc_obj) {
serialization_err("ser_soc_obj is invalid");
return WLAN_SER_CMD_DENIED_UNSPECIFIED;
}
/* /*
* Get Component Info callback by calling * Get Component Info callback by calling

View File

@@ -532,9 +532,12 @@ struct wlan_serialization_pdev_priv_obj *wlan_serialization_get_pdev_priv_obj(
struct wlan_serialization_psoc_priv_obj * struct wlan_serialization_psoc_priv_obj *
wlan_serialization_get_obj(struct wlan_serialization_command *cmd) wlan_serialization_get_obj(struct wlan_serialization_command *cmd)
{ {
struct wlan_serialization_psoc_priv_obj *ser_soc_obj; struct wlan_serialization_psoc_priv_obj *ser_soc_obj = NULL;
struct wlan_objmgr_psoc *psoc; struct wlan_objmgr_psoc *psoc;
if (!cmd->vdev)
return ser_soc_obj;
psoc = wlan_vdev_get_psoc(cmd->vdev); psoc = wlan_vdev_get_psoc(cmd->vdev);
ser_soc_obj = wlan_serialization_get_psoc_priv_obj(psoc); ser_soc_obj = wlan_serialization_get_psoc_priv_obj(psoc);