Browse Source

qcacld-3.0: Fix possible NULL pointer dereference in os_if_nan_legacy_req()

In function os_if_nan_legacy_req(), if qdf_mem_malloc() call return NULL,
this will result in nan_req NULL pointer dereference.

Fix is to add NULL pointer check for nan_req before using.

Change-Id: I8ce9e9f9fa556606cf5e8d389905c39ff7198f2c
CRs-Fixed: 2423772
hqu 6 years ago
parent
commit
dd904c8e39
1 changed files with 3 additions and 0 deletions
  1. 3 0
      os_if/nan/src/os_if_nan.c

+ 3 - 0
os_if/nan/src/os_if_nan.c

@@ -2575,6 +2575,9 @@ int os_if_nan_legacy_req(struct wlan_objmgr_psoc *psoc, const void *data,
 	}
 
 	nan_req = qdf_mem_malloc(sizeof(*nan_req) + data_len);
+	if (!nan_req)
+		return -ENOMEM;
+
 	nan_req->psoc = psoc;
 	nan_req->params.request_data_len = data_len;
 	qdf_mem_copy(nan_req->params.request_data, data, data_len);