ACK: [PATCH 1/2] uefi: uefirtvariable: report failure when setting variable with invalid attribute successfully (LP: #1310686)

Alex Hung alex.hung at canonical.com
Mon May 5 08:26:13 UTC 2014


On 04/28/2014 04:06 PM, Ivan Hu wrote:
> Some buggy firmwares allow to set variable with invalid attributes, and cannot
> be got by the getvariable, that causes the test variable exists in the
> firmware and cannot be set any more, setting variable by setvariable will
> return EFI_INVALID_PARAMETER.
> This patch adds to report fail and clean up the test variable.
>
> Signed-off-by: Ivan Hu <ivan.hu at canonical.com>
> ---
>   src/uefi/uefirtvariable/uefirtvariable.c |   11 ++++++++++-
>   1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/src/uefi/uefirtvariable/uefirtvariable.c b/src/uefi/uefirtvariable/uefirtvariable.c
> index 5d31ad8..6e40542 100644
> --- a/src/uefi/uefirtvariable/uefirtvariable.c
> +++ b/src/uefi/uefirtvariable/uefirtvariable.c
> @@ -1156,6 +1156,7 @@ static int setvariable_test5(fwts_framework *fw)
>
>   static int setvariable_test6(fwts_framework *fw)
>   {
> +	int ret;
>   	uint64_t datasize = 10;
>   	uint8_t datadiff = 0;
>   	uint32_t attributesarray[] = {
> @@ -1166,7 +1167,15 @@ static int setvariable_test6(fwts_framework *fw)
>   	uint64_t index;
>
>   	for (index = 0; index < (sizeof(attributesarray)/(sizeof attributesarray[0])); index++) {
> -		setvariable_invalidattr(fw, attributesarray[index], datasize, variablenametest, &gtestguid1, datadiff);
> +		ret = setvariable_invalidattr(fw, attributesarray[index], datasize, variablenametest, &gtestguid1, datadiff);
> +
> +		if (ret == FWTS_ERROR) {
> +			/* successfully set variable with invalid attributes, test fail */
> +			fwts_failed(fw, LOG_LEVEL_MEDIUM, "UEFIRuntimeSetVariable",
> +				"Successfully set variable with invalid attribute, expected fail.");
> +			setvariable_insertvariable(fw, 0, datasize, variablenametest, &gtestguid1, datadiff);
> +			return FWTS_ERROR;
> +		}
>
>   		if (setvariable_checkvariable_notfound(fw, variablenametest,
>   			&gtestguid1) == FWTS_ERROR) {
>

Acked-by: Alex Hung <alex.hung at canonical.com>



More information about the fwts-devel mailing list