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

Commit cc55bb03 authored by Kevin McKinney's avatar Kevin McKinney Committed by Greg Kroah-Hartman
Browse files

Staging: bcm: fix possible memory leak of 'pstAddIndication' in CmHost.c and removes a whitespace



Memory is being allocated by kmalloc and stored in
variable pstAddIndication.  However, this memory is
not being freed in all cases. Therefore, this patch
frees it on several exit paths. This patch also
removes a whitespace.

Signed-off-by: default avatarKevin McKinney <klmckinney1@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 07b99cf5
Loading
Loading
Loading
Loading
+20 −7
Original line number Original line Diff line number Diff line
@@ -1399,12 +1399,16 @@ ULONG StoreCmControlResponseMessage(PMINI_ADAPTER Adapter, PVOID pvBuffer, UINT
	/* AUTHORIZED SET */
	/* AUTHORIZED SET */
	pstAddIndication->psfAuthorizedSet = (stServiceFlowParamSI *)
	pstAddIndication->psfAuthorizedSet = (stServiceFlowParamSI *)
			GetNextTargetBufferLocation(Adapter, pstAddIndicationAlt->u16TID);
			GetNextTargetBufferLocation(Adapter, pstAddIndicationAlt->u16TID);
	if (!pstAddIndication->psfAuthorizedSet)
	if (!pstAddIndication->psfAuthorizedSet) {
		kfree(pstAddIndication);
		return 0;
		return 0;
	}


	if (StoreSFParam(Adapter, (PUCHAR)&pstAddIndicationAlt->sfAuthorizedSet,
	if (StoreSFParam(Adapter, (PUCHAR)&pstAddIndicationAlt->sfAuthorizedSet,
				(ULONG)pstAddIndication->psfAuthorizedSet) != 1)
				(ULONG)pstAddIndication->psfAuthorizedSet) != 1) {
		kfree(pstAddIndication);
		return 0;
		return 0;
	}


	/* this can't possibly be right */
	/* this can't possibly be right */
	pstAddIndication->psfAuthorizedSet = (stServiceFlowParamSI *)ntohl((ULONG)pstAddIndication->psfAuthorizedSet);
	pstAddIndication->psfAuthorizedSet = (stServiceFlowParamSI *)ntohl((ULONG)pstAddIndication->psfAuthorizedSet);
@@ -1420,6 +1424,7 @@ ULONG StoreCmControlResponseMessage(PMINI_ADAPTER Adapter, PVOID pvBuffer, UINT
		AddRequest.psfParameterSet = pstAddIndication->psfAuthorizedSet;
		AddRequest.psfParameterSet = pstAddIndication->psfAuthorizedSet;
		(*puBufferLength) = sizeof(stLocalSFAddRequest);
		(*puBufferLength) = sizeof(stLocalSFAddRequest);
		memcpy(pvBuffer, &AddRequest, sizeof(stLocalSFAddRequest));
		memcpy(pvBuffer, &AddRequest, sizeof(stLocalSFAddRequest));
		kfree(pstAddIndication);
		return 1;
		return 1;
	}
	}


@@ -1436,20 +1441,28 @@ ULONG StoreCmControlResponseMessage(PMINI_ADAPTER Adapter, PVOID pvBuffer, UINT
	/* ADMITTED SET */
	/* ADMITTED SET */
	pstAddIndication->psfAdmittedSet = (stServiceFlowParamSI *)
	pstAddIndication->psfAdmittedSet = (stServiceFlowParamSI *)
		GetNextTargetBufferLocation(Adapter, pstAddIndicationAlt->u16TID);
		GetNextTargetBufferLocation(Adapter, pstAddIndicationAlt->u16TID);
	if (!pstAddIndication->psfAdmittedSet)
	if (!pstAddIndication->psfAdmittedSet) {
		kfree(pstAddIndication);
		return 0;
		return 0;
	if (StoreSFParam(Adapter, (PUCHAR)&pstAddIndicationAlt->sfAdmittedSet, (ULONG)pstAddIndication->psfAdmittedSet) != 1)
	}
	if (StoreSFParam(Adapter, (PUCHAR)&pstAddIndicationAlt->sfAdmittedSet, (ULONG)pstAddIndication->psfAdmittedSet) != 1) {
		kfree(pstAddIndication);
		return 0;
		return 0;
	}


	pstAddIndication->psfAdmittedSet = (stServiceFlowParamSI *)ntohl((ULONG)pstAddIndication->psfAdmittedSet);
	pstAddIndication->psfAdmittedSet = (stServiceFlowParamSI *)ntohl((ULONG)pstAddIndication->psfAdmittedSet);


	/* ACTIVE SET */
	/* ACTIVE SET */
	pstAddIndication->psfActiveSet = (stServiceFlowParamSI *)
	pstAddIndication->psfActiveSet = (stServiceFlowParamSI *)
		GetNextTargetBufferLocation(Adapter, pstAddIndicationAlt->u16TID);
		GetNextTargetBufferLocation(Adapter, pstAddIndicationAlt->u16TID);
	if (!pstAddIndication->psfActiveSet)
	if (!pstAddIndication->psfActiveSet) {
		kfree(pstAddIndication);
		return 0;
		return 0;
	if (StoreSFParam(Adapter, (PUCHAR)&pstAddIndicationAlt->sfActiveSet, (ULONG)pstAddIndication->psfActiveSet) != 1)
	}
	if (StoreSFParam(Adapter, (PUCHAR)&pstAddIndicationAlt->sfActiveSet, (ULONG)pstAddIndication->psfActiveSet) != 1) {
		kfree(pstAddIndication);
		return 0;
		return 0;
	}


	pstAddIndication->psfActiveSet = (stServiceFlowParamSI *)ntohl((ULONG)pstAddIndication->psfActiveSet);
	pstAddIndication->psfActiveSet = (stServiceFlowParamSI *)ntohl((ULONG)pstAddIndication->psfActiveSet);