From: Jeremy Kerr <jk-mnsaURCQ41sdnm+yROfE0A@public.gmane.org>
To: Matt Fleming <matt-HNK1S37rvNbeXh+fF434Mdi2O/JbrIOy@public.gmane.org>
Cc: linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Anton Vorontsov
<cbouatmailru-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
Colin Cross <ccross-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org>,
Kees Cook <keescook-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
Subject: Re: [RFC,PATCH] efivarfs: Don't delete efivar_entry structures on unlink
Date: Tue, 29 Jan 2013 07:45:29 +0900 [thread overview]
Message-ID: <5106FF89.2020500@ozlabs.org> (raw)
In-Reply-To: <1359391539.8282.28.camel-ZqTwcBeJ+wsBof6jY8KHXm7IUlhRatedral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Hi Matt,
> Isn't there a race here? Can't the efivar_entry be deleted and freed
> before we call efivar_get_entry()?
>
> The problem is you need to be able to ensure the validity of
> inode->i_private, but you can't in the open() function if you haven't
> already taken a reference to the variable. A ref count of some
> description needs to be incremented in efivarfs_fill_super() before the
> efivar_entry pointer is stored in the inode, and while we're holding the
> lock.
Yes, the intention is to bump the refcount any time we store the struct
efivars_entry somewhere it might be referenced later (ie, in
inode->i_private in this case). I'll add the ref when we create the
inodes too.
One of my concerns with the current patch is using the empty list as an
indicator whether the variable is present in firmware. Alternatively, we
could do this with a new bool 'deleted' in the strut efivars_entry,
which is set on unlink(). Any preferences?
Cheers,
Jeremy
next prev parent reply other threads:[~2013-01-28 22:45 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-26 22:52 [RFC,PATCH] efivarfs: Don't delete efivar_entry structures on unlink Jeremy Kerr
2013-01-28 16:45 ` Matt Fleming
[not found] ` <1359391539.8282.28.camel-ZqTwcBeJ+wsBof6jY8KHXm7IUlhRatedral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2013-01-28 22:45 ` Jeremy Kerr [this message]
[not found] ` <5106FF89.2020500-mnsaURCQ41sdnm+yROfE0A@public.gmane.org>
2013-01-29 16:08 ` Matt Fleming
2013-01-30 8:55 ` Lingzhu Xiang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5106FF89.2020500@ozlabs.org \
--to=jk-mnsaurcq41sdnm+yrofe0a@public.gmane.org \
--cc=cbouatmailru-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=ccross-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org \
--cc=keescook-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
--cc=linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=matt-HNK1S37rvNbeXh+fF434Mdi2O/JbrIOy@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.