ACK: [PATCH 2/2] efi_runtime: add checking variable_name input

Colin Ian King colin.king at canonical.com
Thu Aug 11 08:50:59 UTC 2016


On 09/08/16 07:29, Ivan Hu wrote:
> Add checking variable name userspace input before copy from it.
> 
> Signed-off-by: Ivan Hu <ivan.hu at canonical.com>
> ---
>  efi_runtime/efi_runtime.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/efi_runtime/efi_runtime.c b/efi_runtime/efi_runtime.c
> index 86076d3..4f2b372 100644
> --- a/efi_runtime/efi_runtime.c
> +++ b/efi_runtime/efi_runtime.c
> @@ -251,7 +251,7 @@ static long efi_runtime_set_variable(unsigned long arg)
>  	struct efi_setvariable setvariable_local;
>  	efi_guid_t vendor_guid;
>  	efi_status_t status;
> -	uint16_t *name;
> +	uint16_t *name = NULL;
>  	void *data;
>  	int rv;
>  
> @@ -264,9 +264,11 @@ static long efi_runtime_set_variable(unsigned long arg)
>  			   sizeof(vendor_guid)))
>  		return -EFAULT;
>  
> -	rv = copy_ucs2_from_user(&name, setvariable_local.variable_name);
> -	if (rv)
> -		return rv;
> +	if (setvariable_local.variable_name) {
> +		rv = copy_ucs2_from_user(&name, setvariable_local.variable_name);
> +		if (rv)
> +			return rv;
> +	}
>  
>  	data = kmalloc(setvariable_local.data_size, GFP_KERNEL);
>  	if (!data) {
> 
Acked-by: Colin Ian King <colin.king at canonical.com>



More information about the fwts-devel mailing list