Re: [patch] efi: locking fix in efivar_entry_set_safe()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 30/04/13 08:43, Dan Carpenter wrote:
> The intent is that if we aren't allowed to block because we're in an
> NMI or an emergency then we only take the lock if it is uncontended.
> 
> Part of the problem is the test is reversed so we return -EBUSY if we
> acquire the lock.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
> ---
> Static checker stuff.  I haven't tested this.

This looks correct to me. Thanks!

> diff --git a/drivers/firmware/efi/vars.c b/drivers/firmware/efi/vars.c
> index 1d80c1c..f34d8fe 100644
> --- a/drivers/firmware/efi/vars.c
> +++ b/drivers/firmware/efi/vars.c
> @@ -622,10 +622,12 @@ int efivar_entry_set_safe(efi_char16_t *name, efi_guid_t vendor, u32 attributes,
>  	if (!ops->query_variable_store)
>  		return -ENOSYS;
>  
> -	if (!block && spin_trylock_irqsave(&__efivars->lock, flags))
> -		return -EBUSY;
> -	else
> +	if (!block) {
> +		if (!spin_trylock_irqsave(&__efivars->lock, flags))
> +			return -EBUSY;
> +	} else {
>  		spin_lock_irqsave(&__efivars->lock, flags);
> +	}
>  
>  	status = check_var_size(attributes, size + ucs2_strsize(name, 1024));
>  	if (status != EFI_SUCCESS) {


-- 
Matt Fleming, Intel Open Source Technology Center
--
To unsubscribe from this list: send the line "unsubscribe linux-efi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux