Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 14fe8b1c authored by Ashish Kumar Dhanotiya's avatar Ashish Kumar Dhanotiya Committed by nshrivas
Browse files

qcacld-3.0: Possible memory leak in set dwell time api

Dynamically allocated memory is not freed in error case
for sme_config in set dwell time api, this may lead to
mem leak in error case.

Free the dynamically alolocated memory in error case.

Change-Id: Id74c28fbe5600495c86d2e0e8cc2b6809f5b3b48
CRs-Fixed: 2466253
parent 64d502e9
Loading
Loading
Loading
Loading
+20 −11
Original line number Diff line number Diff line
@@ -2331,9 +2331,10 @@ static int hdd_set_dwell_time(struct hdd_adapter *adapter, uint8_t *command)
	sme_get_config_param(mac_handle, sme_config);

	if (strncmp(command, "SETDWELLTIME ACTIVE MAX", 23) == 0) {
		if (drv_cmd_validate(command, 23))
			return -EINVAL;

		if (drv_cmd_validate(command, 23)) {
			retval = -EINVAL;
			goto free;
		}
		value = value + 24;
		temp = kstrtou32(value, 10, &val);
		if (temp != 0 || val < CFG_ACTIVE_MAX_CHANNEL_TIME_MIN ||
@@ -2346,8 +2347,10 @@ static int hdd_set_dwell_time(struct hdd_adapter *adapter, uint8_t *command)
		sme_config->csrConfig.nActiveMaxChnTime = val;
		sme_update_config(mac_handle, sme_config);
	} else if (strncmp(command, "SETDWELLTIME ACTIVE MIN", 23) == 0) {
		if (drv_cmd_validate(command, 23))
			return -EINVAL;
		if (drv_cmd_validate(command, 23)) {
			retval = -EINVAL;
			goto free;
		}

		value = value + 24;
		temp = kstrtou32(value, 10, &val);
@@ -2361,8 +2364,10 @@ static int hdd_set_dwell_time(struct hdd_adapter *adapter, uint8_t *command)
		sme_config->csrConfig.nActiveMinChnTime = val;
		sme_update_config(mac_handle, sme_config);
	} else if (strncmp(command, "SETDWELLTIME PASSIVE MAX", 24) == 0) {
		if (drv_cmd_validate(command, 24))
			return -EINVAL;
		if (drv_cmd_validate(command, 24)) {
			retval = -EINVAL;
			goto free;
		}

		value = value + 25;
		temp = kstrtou32(value, 10, &val);
@@ -2376,8 +2381,10 @@ static int hdd_set_dwell_time(struct hdd_adapter *adapter, uint8_t *command)
		sme_config->csrConfig.nPassiveMaxChnTime = val;
		sme_update_config(mac_handle, sme_config);
	} else if (strncmp(command, "SETDWELLTIME PASSIVE MIN", 24) == 0) {
		if (drv_cmd_validate(command, 24))
			return -EINVAL;
		if (drv_cmd_validate(command, 24)) {
			retval = -EINVAL;
			goto free;
		}

		value = value + 25;
		temp = kstrtou32(value, 10, &val);
@@ -2391,8 +2398,10 @@ static int hdd_set_dwell_time(struct hdd_adapter *adapter, uint8_t *command)
		sme_config->csrConfig.nPassiveMinChnTime = val;
		sme_update_config(mac_handle, sme_config);
	} else if (strncmp(command, "SETDWELLTIME", 12) == 0) {
		if (drv_cmd_validate(command, 12))
			return -EINVAL;
		if (drv_cmd_validate(command, 12)) {
			retval = -EINVAL;
			goto free;
		}

		value = value + 13;
		temp = kstrtou32(value, 10, &val);