linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH 0/4] locks/nfs: fix use-after-free problem in unlock codepath
@ 2015-07-10 20:33 Jeff Layton
  2015-07-10 20:33 ` [RFC PATCH 2/4] locks: have flock_lock_file take an inode pointer instead of a filp Jeff Layton
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Jeff Layton @ 2015-07-10 20:33 UTC (permalink / raw)
  To: linux-nfs-u79uwXL29TY76Z2rM5mHXA
  Cc: linux-fsdevel-u79uwXL29TY76Z2rM5mHXA,
	william-M8Sm6a3kpgNeoWH0uzbU5w, bfields-uC3wQj2KruNg9hUCZPvPmw

William Dauchy reported some instability after trying to apply
db2efec0caba to the v3.14 stable series kernels. The problem was that
that patch had us taking an extra reference to the filp in the NFSv4
unlock code. If we're unlocking locks on task exit though, then we may
be taking a reference after the last reference had already been put.

This fixes the problem in a different way. Most of the locking code is
not terribly concerned with the actual filp, but rather with the inode.
So we can fix this by adding helpers {flock|posix}_inode_lock_wait
helpers and using those from the NFSv4 code. We _know_ that we hold a
reference to the inode by virtue of the NFS open context, so this should
be safe.

I intend to do some more testing of this set over the weekend, but wanted
to get this out there so we can go ahead and get the patch reverted and
get some early feedback.

Jeff Layton (4):
  Revert "nfs: take extra reference to fl->fl_file when running a LOCKU
    operation"
  locks: have flock_lock_file take an inode pointer instead of a filp
  locks: new helpers - flock_lock_inode_wait and posix_lock_inode_wait
  nfs4: have do_vfs_lock take an inode pointer

 fs/locks.c         | 60 ++++++++++++++++++++++++++++++++++++++----------------
 fs/nfs/nfs4proc.c  | 18 ++++++++--------
 include/linux/fs.h | 14 +++++++++++++
 3 files changed, 65 insertions(+), 27 deletions(-)

-- 
2.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2015-07-13 10:22 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-10 20:33 [RFC PATCH 0/4] locks/nfs: fix use-after-free problem in unlock codepath Jeff Layton
2015-07-10 20:33 ` [RFC PATCH 2/4] locks: have flock_lock_file take an inode pointer instead of a filp Jeff Layton
2015-07-10 20:33 ` [RFC PATCH 3/4] locks: new helpers - flock_lock_inode_wait and posix_lock_inode_wait Jeff Layton
2015-07-10 20:33 ` [RFC PATCH 4/4] nfs4: have do_vfs_lock take an inode pointer Jeff Layton
     [not found] ` <1436560414-26306-1-git-send-email-jeff.layton-7I+n7zu2hftEKMMhf/gKZA@public.gmane.org>
2015-07-10 20:33   ` [RFC PATCH 1/4] Revert "nfs: take extra reference to fl->fl_file when running a LOCKU operation" Jeff Layton
2015-07-10 20:51     ` Jeff Layton
2015-07-10 21:10   ` [RFC PATCH 0/4] locks/nfs: fix use-after-free problem in unlock codepath J. Bruce Fields
     [not found]     ` <20150710211054.GB7665-uC3wQj2KruNg9hUCZPvPmw@public.gmane.org>
2015-07-10 21:14       ` Jeff Layton
     [not found]         ` <20150710171426.082be2b0-9yPaYZwiELC+kQycOl6kW4xkIHaj4LzF@public.gmane.org>
2015-07-10 21:21           ` J. Bruce Fields
2015-07-13 10:22   ` [PATCH 5/4] locks: inline posix_lock_file_wait and flock_lock_file_wait Jeff Layton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).