Re: [PATCH 3/6] efivarfs: make variable_is_present use dcache lookup

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

 



On Mon, 2024-12-23 at 20:20 +0000, Al Viro wrote:
> On Tue, Dec 10, 2024 at 12:02:21PM -0500, James Bottomley wrote:
> > Instead of searching the variable entry list for a variable, use
> > the
> > dcache lookup functions to find it instead.  Also add an efivarfs_
> > prefix to the function now it is no longer static.
> 
> > +bool efivarfs_variable_is_present(efi_char16_t *variable_name,
> > +                                 efi_guid_t *vendor, void *data)
> > +{
> > +       char *name = efivar_get_utf8name(variable_name, vendor);
> > +       struct super_block *sb = data;
> > +       struct dentry *dentry;
> > +       struct qstr qstr;
> > +
> > +       if (!name)
> > +               return true;
> > +
> > +       qstr.name = name;
> > +       qstr.len = strlen(name);
> > +       dentry = d_hash_and_lookup(sb->s_root, &qstr);
> > +       kfree(name);
> > +       if (dentry)
> > +               dput(dentry);
> 
> If that ever gets called with efivarfs_valid_name(name, strlen(name))
> being false, that's going to oops...

Well for the current use case that can't happen because a) that check
is gone from efivarfs_d_hash and b) the name is constructed to pass
this check anyway.  But I'm guessing you mean I should be doing

if (dentry && !IS_ERR(dentry))
   dput(dentry);

?

Regards,

James





[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