Skip to content

RFC locks/nfs: fix use-after-free problem in unlock codepath

Jeff Layton linux-fsdevel linux-nfs stable 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest1 of 4 patches 5 repliesIn review

1 of 4 patches is in this archive. The cover letter announces 4.

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4Revert "nfs: take extra reference to fl->fl_file when running a LOCKU operation"fs/nfs/nfs4proc.c+0 -21 reply

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC PATCH 0/4] locks/nfs: fix use-after-free problem in unlock codepath

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(-)
Signature · 6 lines
2.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html