From: "J. Bruce Fields" <bfields@fieldses.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: linux-nfs@vger.kernel.org, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: file locking fix for 3.2
Date: Sat, 24 Dec 2011 16:50:12 -0500 [thread overview]
Message-ID: <20111224215012.GA23495@fieldses.org> (raw)
Please pull the following change from the for-3.2 branch at:
git://linux-nfs.org/~bfields/linux.git for-3.2
One small 3.2 regression in the file-locking code. Seems like an
unlikely bug (null dereference on kmalloc failure), but the fix is a
one-liner.
--b.
J. Bruce Fields (1):
locks: fix null dereference on lease-break failure path
fs/locks.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
commit b67e18a8e3425725cc17cc7633bccb06fb3c9eda
Author: J. Bruce Fields <bfields@redhat.com>
Date: Mon Dec 19 17:57:11 2011 -0500
locks: fix null dereference on lease-break failure path
Commit 778fc546f749c588aa2f6cd50215d2715c374252 "locks: fix tracking of
inprogress lease breaks" introduced a null dereference on failure to
allocate memory.
This means an open (without O_NONBLOCK set) on a file with a lease
applied (generally only done when Samba or nfsd (with v4) is running)
could crash if a kmalloc() fails.
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
diff --git a/fs/locks.c b/fs/locks.c
index 3b0d05d..96a487a 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -1214,8 +1214,8 @@ int __break_lease(struct inode *inode, unsigned int mode)
if ((flock == NULL) || !IS_LEASE(flock))
goto out;
- if (!locks_conflict(flock, new_fl))
- goto out;
+ if (flock->fl_type == F_RDLCK && !want_write)
+ goto out; /* no conflict */
for (fl = flock; fl && IS_LEASE(fl); fl = fl->fl_next)
if (fl->fl_owner == current->files)
next reply other threads:[~2011-12-24 21:50 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-24 21:50 J. Bruce Fields [this message]
2011-12-24 22:55 ` file locking fix for 3.2 Al Viro
2011-12-24 23:50 ` J. Bruce Fields
2011-12-25 0:05 ` Al Viro
2011-12-25 18:19 ` J. Bruce Fields
2011-12-26 18:37 ` Linus Torvalds
2011-12-26 20:18 ` J. Bruce Fields
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=20111224215012.GA23495@fieldses.org \
--to=bfields@fieldses.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=torvalds@linux-foundation.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 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).