On Fri, 15 Jul, at 09:36:30PM, Ard Biesheuvel wrote: > From: Sylvain Chouleur <sylvain.chouleur@xxxxxxxxx> > > 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@xxxxxxxxx> > [ardb: rebased onto v4.7-rc3, remove lockdep_assert_xxx() calls] > Signed-off-by: Ard Biesheuvel <ard.biesheuvel@xxxxxxxxxx> > --- > v3: remove lockdep_assert() calls: they are no longer appropriate now that we > have switched to a semaphore > v2: rebased onto v4.7-rc3 > > drivers/firmware/efi/efi-pstore.c | 36 +++-- > drivers/firmware/efi/efivars.c | 22 +++- > drivers/firmware/efi/vars.c | 137 ++++++++++++-------- > fs/efivarfs/inode.c | 5 +- > fs/efivarfs/super.c | 9 +- > include/linux/efi.h | 6 +- > 6 files changed, 139 insertions(+), 76 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: Tobias, this patch requires the exact error path that was removed in patch ("efivarfs: Eliminate dead code in efivarfs_create()"). Which unfortunately means I'm going to drop your patch from the queue. -- 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