summaryrefslogtreecommitdiff
path: root/fs/efivarfs/inode.c
diff options
context:
space:
mode:
authorSylvain Chouleur <sylvain.chouleur@intel.com>2016-07-15 21:36:30 +0200
committerMatt Fleming <matt@codeblueprint.co.uk>2016-09-09 16:08:42 +0100
commit21b3ddd39feecd2f4d6c52bcd30f0a4fa14f125a (patch)
tree40773635e6415ce23293c67eda0327dddec90ae7 /fs/efivarfs/inode.c
parent217b27d4671a0a3f34147f1b341683d36b7457db (diff)
efi: Don't use spinlocks for efi vars
All efivars operations are protected by a spinlock which prevents interruptions and preemption. This is too restricted, we just need a lock preventing concurrency. The idea is to use a semaphore of count 1 and to have two ways of locking, depending on the context: - In interrupt context, we call down_trylock(), if it fails we return an error - In normal context, we call down_interruptible() We don't use a mutex here because the mutex_trylock() function must not be called from interrupt context, whereas the down_trylock() can. Signed-off-by: Sylvain Chouleur <sylvain.chouleur@intel.com> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Leif Lindholm <leif.lindholm@linaro.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Sylvain Chouleur <sylvain.chouleur@gmail.com> Signed-off-by: Matt Fleming <matt@codeblueprint.co.uk>
Diffstat (limited to 'fs/efivarfs/inode.c')
-rw-r--r--fs/efivarfs/inode.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/efivarfs/inode.c b/fs/efivarfs/inode.c
index 1d73fc6dba13..cbb50cadcffc 100644
--- a/fs/efivarfs/inode.c
+++ b/fs/efivarfs/inode.c
@@ -105,7 +105,10 @@ static int efivarfs_create(struct inode *dir, struct dentry *dentry,
inode->i_private = var;
- efivar_entry_add(var, &efivarfs_list);
+ err = efivar_entry_add(var, &efivarfs_list);
+ if (err)
+ goto out;
+
d_instantiate(dentry, inode);
dget(dentry);
out: