Переглянути джерело

qcacmn: Add Passphrase and Service Name parameter to NDP cmds

Add Passphrase and Service Name to NDP initiator request and NDP
responder request.

Change-Id: I6a189747760a15393fcbac9dc382847fef789ab1
CRs-Fixed: 2072498
Naveen Rawat 7 роки тому
батько
коміт
7b62aff6c7

+ 7 - 0
os_if/linux/nan/inc/os_if_nan.h

@@ -37,6 +37,9 @@ struct wlan_objmgr_vdev;
 #define NDP_PMK_LEN 32
 #define NDP_SCID_BUF_LEN 256
 #define NDP_NUM_INSTANCE_ID 255
+#define NAN_MAX_SERVICE_NAME_LEN 255
+#define NAN_PASSPHRASE_MIN_LEN 8
+#define NAN_PASSPHRASE_MAX_LEN 63
 
 /**
  * enum qca_wlan_vendor_attr_ndp_params - vendor attribute parameters
@@ -60,6 +63,8 @@ struct wlan_objmgr_vdev;
  * @QCA_WLAN_VENDOR_ATTR_NDP_NCS_SK_TYPE: Cipher Suit ID
  * @QCA_WLAN_VENDOR_ATTR_NDP_PMK: Pairwise Master Key
  * @QCA_WLAN_VENDOR_ATTR_NDP_SCID: Security Context ID
+ * @QCA_WLAN_VENDOR_ATTR_NDP_PASSPHRASE - pass phrase
+ * @QCA_WLAN_VENDOR_ATTR_NDP_SERVICE_NAME - service name
  */
 enum qca_wlan_vendor_attr_ndp_params {
 	QCA_WLAN_VENDOR_ATTR_NDP_PARAM_INVALID = 0,
@@ -83,6 +88,8 @@ enum qca_wlan_vendor_attr_ndp_params {
 	QCA_WLAN_VENDOR_ATTR_NDP_NCS_SK_TYPE,
 	QCA_WLAN_VENDOR_ATTR_NDP_PMK,
 	QCA_WLAN_VENDOR_ATTR_NDP_SCID,
+	QCA_WLAN_VENDOR_ATTR_NDP_PASSPHRASE,
+	QCA_WLAN_VENDOR_ATTR_NDP_SERVICE_NAME,
 
 	QCA_WLAN_VENDOR_ATTR_NDP_PARAMS_AFTER_LAST,
 	QCA_WLAN_VENDOR_ATTR_NDP_PARAMS_MAX =

+ 75 - 34
os_if/linux/nan/src/os_if_nan.c

@@ -65,6 +65,10 @@ vendor_attr_policy[QCA_WLAN_VENDOR_ATTR_NDP_PARAMS_MAX + 1] = {
 	[QCA_WLAN_VENDOR_ATTR_NDP_DRV_RESPONSE_STATUS_TYPE] = { .type =
 					NLA_U32 },
 	[QCA_WLAN_VENDOR_ATTR_NDP_DRV_RETURN_VALUE] = { .type = NLA_U32 },
+	[QCA_WLAN_VENDOR_ATTR_NDP_PASSPHRASE] = { .type = NLA_BINARY,
+					.len = NAN_PASSPHRASE_MAX_LEN },
+	[QCA_WLAN_VENDOR_ATTR_NDP_SERVICE_NAME] = { .type = NLA_BINARY,
+					.len = NAN_MAX_SERVICE_NAME_LEN },
 };
 
 static int os_if_nan_process_ndi_create(struct wlan_objmgr_psoc *psoc,
@@ -169,6 +173,67 @@ static int os_if_nan_process_ndi_delete(struct wlan_objmgr_psoc *psoc,
 	return cb_obj.ndi_delete(vdev_id, iface_name, transaction_id);
 }
 
+/**
+ * os_if_nan_parse_security_params() - parse vendor attributes for security
+ * params.
+ * @tb: parsed NL attribute list
+ * @ncs_sk_type: out parameter to populate ncs_sk_type
+ * @pmk: out parameter to populate pmk
+ * @passphrase: out parameter to populate passphrase
+ * @service_name: out parameter to populate service_name
+ *
+ * Return:  0 on success or error code on failure
+ */
+static int os_if_nan_parse_security_params(struct nlattr **tb,
+			uint32_t *ncs_sk_type, struct nan_datapath_pmk *pmk,
+			struct ndp_passphrase *passphrase,
+			struct ndp_service_name *service_name)
+{
+	if (!ncs_sk_type || !pmk || !passphrase || !service_name) {
+		cfg80211_err("out buffers for one ore more parameters is null");
+		return -EINVAL;
+	}
+
+	if (tb[QCA_WLAN_VENDOR_ATTR_NDP_NCS_SK_TYPE]) {
+		*ncs_sk_type =
+			nla_get_u32(tb[QCA_WLAN_VENDOR_ATTR_NDP_NCS_SK_TYPE]);
+	}
+
+	if (tb[QCA_WLAN_VENDOR_ATTR_NDP_PMK]) {
+		pmk->pmk_len =
+			nla_len(tb[QCA_WLAN_VENDOR_ATTR_NDP_PMK]);
+		pmk->pmk =
+			nla_data(tb[QCA_WLAN_VENDOR_ATTR_NDP_PMK]);
+		cfg80211_err("pmk len: %d", pmk->pmk_len);
+		QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR,
+				   pmk->pmk, pmk->pmk_len);
+	}
+
+	if (tb[QCA_WLAN_VENDOR_ATTR_NDP_PASSPHRASE]) {
+		passphrase->passphrase_len =
+			nla_len(tb[QCA_WLAN_VENDOR_ATTR_NDP_PASSPHRASE]);
+		passphrase->passphrase =
+			nla_data(tb[QCA_WLAN_VENDOR_ATTR_NDP_PASSPHRASE]);
+		cfg80211_err("passphrase len: %d", passphrase->passphrase_len);
+		QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR,
+			passphrase->passphrase, passphrase->passphrase_len);
+	}
+
+	if (tb[QCA_WLAN_VENDOR_ATTR_NDP_SERVICE_NAME]) {
+		service_name->service_name_len =
+			nla_len(tb[QCA_WLAN_VENDOR_ATTR_NDP_SERVICE_NAME]);
+		service_name->service_name =
+			nla_data(tb[QCA_WLAN_VENDOR_ATTR_NDP_SERVICE_NAME]);
+		cfg80211_err("service_name len: %d",
+			     service_name->service_name_len);
+		QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR,
+				service_name->service_name,
+				service_name->service_name_len);
+	}
+
+	return 0;
+}
+
 /**
  * os_if_nan_process_ndp_initiator_req() - NDP initiator request handler
  * @ctx: hdd context
@@ -185,6 +250,8 @@ static int os_if_nan_process_ndi_delete(struct wlan_objmgr_psoc *psoc,
  * QCA_WLAN_VENDOR_ATTR_NDP_CONFIG_QOS - optional
  * QCA_WLAN_VENDOR_ATTR_NDP_PMK - optional
  * QCA_WLAN_VENDOR_ATTR_NDP_NCS_SK_TYPE - optional
+ * QCA_WLAN_VENDOR_ATTR_NDP_PASSPHRASE - optional
+ * QCA_WLAN_VENDOR_ATTR_NDP_SERVICE_NAME - optional
  *
  * Return:  0 on success or error code on failure
  */
@@ -276,27 +343,13 @@ static int os_if_nan_process_ndp_initiator_req(struct wlan_objmgr_psoc *psoc,
 			nla_get_u32(tb[QCA_WLAN_VENDOR_ATTR_NDP_CONFIG_QOS]);
 	}
 
-	if (tb[QCA_WLAN_VENDOR_ATTR_NDP_NCS_SK_TYPE] &&
-		!tb[QCA_WLAN_VENDOR_ATTR_NDP_PMK]) {
-		cfg80211_err("PMK cannot be absent when CSID is present.");
+	if (os_if_nan_parse_security_params(tb, &req.ncs_sk_type, &req.pmk,
+			&req.passphrase, &req.service_name)) {
+		cfg80211_err("inconsistent security params in request.");
 		ret = -EINVAL;
 		goto initiator_req_failed;
 	}
 
-	if (tb[QCA_WLAN_VENDOR_ATTR_NDP_PMK]) {
-		req.pmk.pmk = nla_data(tb[QCA_WLAN_VENDOR_ATTR_NDP_PMK]);
-		req.pmk.pmk_len = nla_len(tb[QCA_WLAN_VENDOR_ATTR_NDP_PMK]);
-		QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_HDD,
-				QDF_TRACE_LEVEL_DEBUG,
-				req.pmk.pmk, req.pmk.pmk_len);
-	}
-
-	if (tb[QCA_WLAN_VENDOR_ATTR_NDP_NCS_SK_TYPE]) {
-		req.ncs_sk_type =
-			nla_get_u32(tb[QCA_WLAN_VENDOR_ATTR_NDP_NCS_SK_TYPE]);
-
-	}
-
 	cfg80211_debug("vdev_id: %d, transaction_id: %d, channel: %d, service_instance_id: %d, ndp_app_info_len: %d, csid: %d, peer_discovery_mac_addr: %pM",
 		wlan_vdev_get_id(nan_vdev), req.transaction_id, req.channel,
 		req.service_instance_id, req.ndp_info.ndp_app_info_len,
@@ -324,6 +377,8 @@ initiator_req_failed:
  * QCA_WLAN_VENDOR_ATTR_NDP_CONFIG_QOS - optional
  * QCA_WLAN_VENDOR_ATTR_NDP_PMK - optional
  * QCA_WLAN_VENDOR_ATTR_NDP_NCS_SK_TYPE - optional
+ * QCA_WLAN_VENDOR_ATTR_NDP_PASSPHRASE - optional
+ * QCA_WLAN_VENDOR_ATTR_NDP_SERVICE_NAME - optional
  *
  * Return: 0 on success or error code on failure
  */
@@ -406,27 +461,13 @@ static int os_if_nan_process_ndp_responder_req(struct wlan_objmgr_psoc *psoc,
 		cfg80211_debug("NDP config data is unavailable");
 	}
 
-	if (tb[QCA_WLAN_VENDOR_ATTR_NDP_NCS_SK_TYPE] &&
-		!tb[QCA_WLAN_VENDOR_ATTR_NDP_PMK]) {
-		cfg80211_err("PMK cannot be absent when CSID is present.");
+	if (os_if_nan_parse_security_params(tb, &req.ncs_sk_type, &req.pmk,
+			&req.passphrase, &req.service_name)) {
+		cfg80211_err("inconsistent security params in request.");
 		ret = -EINVAL;
 		goto responder_req_failed;
 	}
 
-	if (tb[QCA_WLAN_VENDOR_ATTR_NDP_PMK]) {
-		req.pmk.pmk = nla_data(tb[QCA_WLAN_VENDOR_ATTR_NDP_PMK]);
-		req.pmk.pmk_len = nla_len(tb[QCA_WLAN_VENDOR_ATTR_NDP_PMK]);
-		QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_HDD,
-				QDF_TRACE_LEVEL_DEBUG,
-				req.pmk.pmk, req.pmk.pmk_len);
-	}
-
-	if (tb[QCA_WLAN_VENDOR_ATTR_NDP_NCS_SK_TYPE]) {
-		req.ncs_sk_type =
-			nla_get_u32(tb[QCA_WLAN_VENDOR_ATTR_NDP_NCS_SK_TYPE]);
-
-	}
-
 	cfg80211_debug("vdev_id: %d, transaction_id: %d, ndp_rsp %d, ndp_instance_id: %d, ndp_app_info_len: %d, csid: %d",
 		wlan_vdev_get_id(nan_vdev), req.transaction_id, req.ndp_rsp,
 		req.ndp_instance_id, req.ndp_info.ndp_app_info_len,

+ 63 - 4
target_if/nan/src/target_if_nan.c

@@ -120,6 +120,7 @@ static QDF_STATUS target_if_nan_ndp_intiaitor_req(void *req)
 	struct wlan_objmgr_psoc *psoc;
 	struct scheduler_msg pe_msg = {0};
 	wmi_ndp_initiator_req_fixed_param *cmd;
+	uint32_t passphrase_len, service_name_len;
 	struct wlan_lmac_if_nan_rx_ops *nan_rx_ops;
 	uint32_t ndp_cfg_len, ndp_app_info_len, pmk_len;
 	struct nan_datapath_initiator_rsp ndp_rsp = {0};
@@ -155,9 +156,13 @@ static QDF_STATUS target_if_nan_ndp_intiaitor_req(void *req)
 	ndp_cfg_len = qdf_roundup(ndp_req->ndp_config.ndp_cfg_len, 4);
 	ndp_app_info_len = qdf_roundup(ndp_req->ndp_info.ndp_app_info_len, 4);
 	pmk_len = qdf_roundup(ndp_req->pmk.pmk_len, 4);
+	passphrase_len = qdf_roundup(ndp_req->passphrase.passphrase_len, 4);
+	service_name_len =
+		qdf_roundup(ndp_req->service_name.service_name_len, 4);
 	/* allocated memory for fixed params as well as variable size data */
-	len = sizeof(*cmd) + sizeof(*ch_tlv) + (3 * WMI_TLV_HDR_SIZE)
-		+ ndp_cfg_len + ndp_app_info_len + pmk_len;
+	len = sizeof(*cmd) + sizeof(*ch_tlv) + (5 * WMI_TLV_HDR_SIZE)
+		+ ndp_cfg_len + ndp_app_info_len + pmk_len
+		+ passphrase_len + service_name_len;
 
 	buf = wmi_buf_alloc(wmi_handle, len);
 	if (!buf) {
@@ -181,6 +186,8 @@ static QDF_STATUS target_if_nan_ndp_intiaitor_req(void *req)
 	cmd->ndp_channel_cfg = ndp_req->channel_cfg;
 	cmd->nan_pmk_len = ndp_req->pmk.pmk_len;
 	cmd->nan_csid = ndp_req->ncs_sk_type;
+	cmd->nan_passphrase_len = ndp_req->passphrase.passphrase_len;
+	cmd->nan_servicename_len = ndp_req->service_name.service_name_len;
 
 	ch_tlv = (wmi_channel *)&cmd[1];
 	WMITLV_SET_HDR(ch_tlv, WMITLV_TAG_STRUC_wmi_channel,
@@ -207,6 +214,17 @@ static QDF_STATUS target_if_nan_ndp_intiaitor_req(void *req)
 		     cmd->nan_pmk_len);
 	tlv_ptr = tlv_ptr + WMI_TLV_HDR_SIZE + pmk_len;
 
+	WMITLV_SET_HDR(tlv_ptr, WMITLV_TAG_ARRAY_BYTE, passphrase_len);
+	qdf_mem_copy(&tlv_ptr[WMI_TLV_HDR_SIZE], ndp_req->passphrase.passphrase,
+		     cmd->nan_passphrase_len);
+	tlv_ptr = tlv_ptr + WMI_TLV_HDR_SIZE + passphrase_len;
+
+	WMITLV_SET_HDR(tlv_ptr, WMITLV_TAG_ARRAY_BYTE, service_name_len);
+	qdf_mem_copy(&tlv_ptr[WMI_TLV_HDR_SIZE],
+		     ndp_req->service_name.service_name,
+		     cmd->nan_servicename_len);
+	tlv_ptr = tlv_ptr + WMI_TLV_HDR_SIZE + service_name_len;
+
 	target_if_debug("vdev_id = %d, transaction_id: %d, service_instance_id: %d, ch: %d, ch_cfg: %d, csid: %d",
 		cmd->vdev_id, cmd->transaction_id, cmd->service_instance_id,
 		ch_tlv->mhz, cmd->ndp_channel_cfg, cmd->nan_csid);
@@ -227,6 +245,17 @@ static QDF_STATUS target_if_nan_ndp_intiaitor_req(void *req)
 	target_if_debug("pmk len: %d", cmd->nan_pmk_len);
 	QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_WMA, QDF_TRACE_LEVEL_DEBUG,
 			   ndp_req->pmk.pmk, cmd->nan_pmk_len);
+
+	target_if_debug("pass phrase len: %d", cmd->nan_passphrase_len);
+	QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_WMA, QDF_TRACE_LEVEL_DEBUG,
+			   ndp_req->passphrase.passphrase,
+			   cmd->nan_passphrase_len);
+
+	target_if_debug("service name len: %d", cmd->nan_servicename_len);
+	QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_WMA, QDF_TRACE_LEVEL_DEBUG,
+			   ndp_req->service_name.service_name,
+			   cmd->nan_servicename_len);
+
 	target_if_debug("sending WMI_NDP_INITIATOR_REQ_CMDID(0x%X)",
 		WMI_NDP_INITIATOR_REQ_CMDID);
 
@@ -544,6 +573,7 @@ static QDF_STATUS target_if_nan_ndp_responder_req(
 	struct wlan_objmgr_psoc *psoc;
 	struct scheduler_msg pe_msg = {0};
 	wmi_ndp_responder_req_fixed_param *cmd;
+	uint32_t passphrase_len, service_name_len;
 	struct wlan_lmac_if_nan_rx_ops *nan_rx_ops;
 	struct nan_datapath_responder_rsp rsp = {0};
 	uint32_t vdev_id = 0, ndp_cfg_len, ndp_app_info_len, pmk_len;
@@ -585,9 +615,13 @@ static QDF_STATUS target_if_nan_ndp_responder_req(
 	ndp_cfg_len = qdf_roundup(req->ndp_config.ndp_cfg_len, 4);
 	ndp_app_info_len = qdf_roundup(req->ndp_info.ndp_app_info_len, 4);
 	pmk_len = qdf_roundup(req->pmk.pmk_len, 4);
+	passphrase_len = qdf_roundup(req->passphrase.passphrase_len, 4);
+	service_name_len =
+		qdf_roundup(req->service_name.service_name_len, 4);
+
 	/* allocated memory for fixed params as well as variable size data */
-	len = sizeof(*cmd) + 3*WMI_TLV_HDR_SIZE + ndp_cfg_len + ndp_app_info_len
-		+ pmk_len;
+	len = sizeof(*cmd) + 5*WMI_TLV_HDR_SIZE + ndp_cfg_len + ndp_app_info_len
+		+ pmk_len + passphrase_len + service_name_len;
 
 	buf = wmi_buf_alloc(wmi_handle, len);
 	if (!buf) {
@@ -608,6 +642,8 @@ static QDF_STATUS target_if_nan_ndp_responder_req(
 	cmd->ndp_app_info_len = req->ndp_info.ndp_app_info_len;
 	cmd->nan_pmk_len = req->pmk.pmk_len;
 	cmd->nan_csid = req->ncs_sk_type;
+	cmd->nan_passphrase_len = req->passphrase.passphrase_len;
+	cmd->nan_servicename_len = req->service_name.service_name_len;
 
 	tlv_ptr = (uint8_t *)&cmd[1];
 	WMITLV_SET_HDR(tlv_ptr, WMITLV_TAG_ARRAY_BYTE, ndp_cfg_len);
@@ -626,6 +662,19 @@ static QDF_STATUS target_if_nan_ndp_responder_req(
 		     cmd->nan_pmk_len);
 
 	tlv_ptr = tlv_ptr + WMI_TLV_HDR_SIZE + pmk_len;
+	WMITLV_SET_HDR(tlv_ptr, WMITLV_TAG_ARRAY_BYTE, passphrase_len);
+	qdf_mem_copy(&tlv_ptr[WMI_TLV_HDR_SIZE],
+		     req->passphrase.passphrase,
+		     cmd->nan_passphrase_len);
+	tlv_ptr = tlv_ptr + WMI_TLV_HDR_SIZE + passphrase_len;
+
+	WMITLV_SET_HDR(tlv_ptr, WMITLV_TAG_ARRAY_BYTE, service_name_len);
+	qdf_mem_copy(&tlv_ptr[WMI_TLV_HDR_SIZE],
+		     req->service_name.service_name,
+		     cmd->nan_servicename_len);
+
+	tlv_ptr = tlv_ptr + WMI_TLV_HDR_SIZE + service_name_len;
+
 	target_if_debug("vdev_id = %d, transaction_id: %d, csid: %d",
 		cmd->vdev_id, cmd->transaction_id, cmd->nan_csid);
 
@@ -645,6 +694,16 @@ static QDF_STATUS target_if_nan_ndp_responder_req(
 	QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_WMA, QDF_TRACE_LEVEL_DEBUG,
 			   req->pmk.pmk, cmd->nan_pmk_len);
 
+	target_if_debug("pass phrase len: %d", cmd->nan_passphrase_len);
+	QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_WMA, QDF_TRACE_LEVEL_DEBUG,
+			   req->passphrase.passphrase,
+			   cmd->nan_passphrase_len);
+
+	target_if_debug("service name len: %d", cmd->nan_servicename_len);
+	QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_WMA, QDF_TRACE_LEVEL_DEBUG,
+			   req->service_name.service_name,
+			   cmd->nan_servicename_len);
+
 	target_if_debug("sending WMI_NDP_RESPONDER_REQ_CMDID(0x%X)",
 		WMI_NDP_RESPONDER_REQ_CMDID);
 	ret = wmi_unified_cmd_send(wmi_handle, buf, len,

+ 30 - 1
umac/nan/core/inc/nan_public_structs.h

@@ -229,6 +229,28 @@ struct nan_datapath_scid {
 	uint8_t *scid;
 };
 
+/**
+ * struct ndp_passphrase - structure to hold passphrase
+ * @passphrase_len: length of passphrase
+ * @passphrase: buffer containing passphrase
+ *
+ */
+struct ndp_passphrase {
+	uint32_t passphrase_len;
+	uint8_t *passphrase;
+};
+
+/**
+ * struct ndp_service_name - structure to hold service_name
+ * @service_name_len: length of service_name
+ * @service_name: buffer containing service_name
+ *
+ */
+struct ndp_service_name {
+	uint32_t service_name_len;
+	uint8_t *service_name;
+};
+
 /**
  * struct peer_nan_datapath_map  - mapping of NDP instances to peer to VDEV
  * @vdev_id: session id of the interface over which ndp is being created
@@ -295,7 +317,8 @@ struct nan_datapath_inf_delete_rsp {
  * @ndp_info: ndp application info
  * @ncs_sk_type: indicates NCS_SK_128 or NCS_SK_256
  * @pmk: pairwise master key
- *
+ * @passphrase: passphrase
+ * @service_name: service name
  */
 struct nan_datapath_initiator_req {
 	struct wlan_objmgr_vdev *vdev;
@@ -309,6 +332,8 @@ struct nan_datapath_initiator_req {
 	struct nan_datapath_cfg ndp_config;
 	struct nan_datapath_app_info ndp_info;
 	struct nan_datapath_pmk pmk;
+	struct ndp_passphrase passphrase;
+	struct ndp_service_name service_name;
 };
 
 /**
@@ -339,6 +364,8 @@ struct nan_datapath_initiator_rsp {
  * @ndp_info: ndp application info
  * @pmk: pairwise master key
  * @ncs_sk_type: indicates NCS_SK_128 or NCS_SK_256
+ * @passphrase: passphrase
+ * @service_name: service name
  *
  */
 struct nan_datapath_responder_req {
@@ -350,6 +377,8 @@ struct nan_datapath_responder_req {
 	struct nan_datapath_app_info ndp_info;
 	struct nan_datapath_pmk pmk;
 	uint32_t ncs_sk_type;
+	struct ndp_passphrase passphrase;
+	struct ndp_service_name service_name;
 };
 
 /**

+ 4 - 0
umac/nan/core/src/nan_main.c

@@ -74,6 +74,8 @@ void nan_release_cmd(void *in_req, uint32_t req_type)
 		qdf_mem_free(req->pmk.pmk);
 		qdf_mem_free(req->ndp_info.ndp_app_info);
 		qdf_mem_free(req->ndp_config.ndp_cfg);
+		qdf_mem_free(req->passphrase.passphrase);
+		qdf_mem_free(req->service_name.service_name);
 		break;
 	}
 	case NDP_RESPONDER_REQ: {
@@ -82,6 +84,8 @@ void nan_release_cmd(void *in_req, uint32_t req_type)
 		qdf_mem_free(req->pmk.pmk);
 		qdf_mem_free(req->ndp_info.ndp_app_info);
 		qdf_mem_free(req->ndp_config.ndp_cfg);
+		qdf_mem_free(req->passphrase.passphrase);
+		qdf_mem_free(req->service_name.service_name);
 		break;
 	}
 	case NDP_END_REQ: {

+ 62 - 0
umac/nan/dispatcher/src/nan_ucfg_api.c

@@ -369,11 +369,42 @@ static struct nan_datapath_initiator_req *ucfg_nan_copy_intiator_req(
 			     in_req->pmk.pmk_len);
 	}
 
+	if (in_req->passphrase.passphrase_len) {
+		out_req->passphrase.passphrase =
+			qdf_mem_malloc(in_req->passphrase.passphrase_len);
+		if (NULL == out_req->passphrase.passphrase) {
+			nan_alert("malloc failed");
+			goto free_resources;
+		}
+		qdf_mem_copy(out_req->passphrase.passphrase,
+			     in_req->passphrase.passphrase,
+			     in_req->passphrase.passphrase_len);
+	}
+
+	if (in_req->service_name.service_name_len) {
+		out_req->service_name.service_name =
+		    qdf_mem_malloc(in_req->service_name.service_name_len);
+		if (NULL == out_req->service_name.service_name) {
+			nan_alert("malloc failed");
+			goto free_resources;
+		}
+		qdf_mem_copy(out_req->service_name.service_name,
+			     in_req->service_name.service_name,
+			     in_req->service_name.service_name_len);
+	}
+
+	nan_debug("pmk_len: %d, passphrase_len: %d, service_name_len: %d",
+		  out_req->pmk.pmk_len,
+		  out_req->passphrase.passphrase_len,
+		  out_req->service_name.service_name_len);
+
 	/* do not get ref here, rather take ref when request is activated */
 	out_req->vdev = vdev;
 	return out_req;
 
 free_resources:
+	qdf_mem_free(out_req->passphrase.passphrase);
+	qdf_mem_free(out_req->service_name.service_name);
 	qdf_mem_free(out_req->pmk.pmk);
 	qdf_mem_free(out_req->ndp_info.ndp_app_info);
 	qdf_mem_free(out_req->ndp_config.ndp_cfg);
@@ -428,11 +459,42 @@ static struct nan_datapath_responder_req *ucfg_nan_copy_responder_req(
 				in_req->pmk.pmk_len);
 	}
 
+	if (in_req->passphrase.passphrase_len) {
+		req->passphrase.passphrase =
+			qdf_mem_malloc(in_req->passphrase.passphrase_len);
+		if (NULL == req->passphrase.passphrase) {
+			nan_alert("malloc failed");
+			goto free_resources;
+		}
+		qdf_mem_copy(req->passphrase.passphrase,
+			     in_req->passphrase.passphrase,
+			     in_req->passphrase.passphrase_len);
+	}
+
+	if (in_req->service_name.service_name_len) {
+		req->service_name.service_name =
+		    qdf_mem_malloc(in_req->service_name.service_name_len);
+		if (NULL == req->service_name.service_name) {
+			nan_alert("malloc failed");
+			goto free_resources;
+		}
+		qdf_mem_copy(req->service_name.service_name,
+			     in_req->service_name.service_name,
+			     in_req->service_name.service_name_len);
+	}
+
+	nan_debug("pmk_len: %d, passphrase_len: %d, service_name_len: %d",
+		  req->pmk.pmk_len,
+		  req->passphrase.passphrase_len,
+		  req->service_name.service_name_len);
+
 	/* do not get ref here, rather take ref when request is activated */
 	req->vdev = vdev;
 	return req;
 
 free_resources:
+	qdf_mem_free(req->passphrase.passphrase);
+	qdf_mem_free(req->service_name.service_name);
 	qdf_mem_free(req->pmk.pmk);
 	qdf_mem_free(req->ndp_info.ndp_app_info);
 	qdf_mem_free(req->ndp_config.ndp_cfg);