Linux-Fsdevel Archive on lore.kernel.org
help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: linux-afs@lists.infradead.org
Cc: Dave Botsch <botsch@cnf.cornell.edu>,
Dave Botsch <botsch@cnf.cornell.edu>,
dhowells@redhat.com, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH 2/6] afs: Fix file locking
Date: Tue, 09 Jun 2020 17:13:19 +0100 [thread overview]
Message-ID: <159171919967.3038039.17802563446058952615.stgit@warthog.procyon.org.uk> (raw)
In-Reply-To: <159171918506.3038039.10915051218779105094.stgit@warthog.procyon.org.uk>
Fix AFS file locking to use the correct vnode pointer and remove a member
of the afs_operation struct that is never set, but it is read and followed,
causing an oops.
This can be triggered by:
flock -s /afs/example.com/foo sleep 1
when it calls the kernel to get a file lock.
Fixes: e49c7b2f6de7 ("afs: Build an abstraction around an "operation" concept")
Reported-by: Dave Botsch <botsch@cnf.cornell.edu>
Signed-off-by: David Howells <dhowells@redhat.com>
Tested-by: Dave Botsch <botsch@cnf.cornell.edu>
---
fs/afs/flock.c | 2 +-
fs/afs/internal.h | 1 -
2 files changed, 1 insertion(+), 2 deletions(-)
diff --git a/fs/afs/flock.c b/fs/afs/flock.c
index 70e518f7bc19..71eea2a908c7 100644
--- a/fs/afs/flock.c
+++ b/fs/afs/flock.c
@@ -71,7 +71,7 @@ static void afs_schedule_lock_extension(struct afs_vnode *vnode)
void afs_lock_op_done(struct afs_call *call)
{
struct afs_operation *op = call->op;
- struct afs_vnode *vnode = op->lock.lvnode;
+ struct afs_vnode *vnode = op->file[0].vnode;
if (call->error == 0) {
spin_lock(&vnode->lock);
diff --git a/fs/afs/internal.h b/fs/afs/internal.h
index e1621b0670cc..519ffb104616 100644
--- a/fs/afs/internal.h
+++ b/fs/afs/internal.h
@@ -795,7 +795,6 @@ struct afs_operation {
struct afs_read *req;
} fetch;
struct {
- struct afs_vnode *lvnode; /* vnode being locked */
afs_lock_type_t type;
} lock;
struct {
next prev parent reply other threads:[~2020-06-09 16:13 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-09 16:13 [PATCH 0/6] afs: Fixes David Howells
2020-06-09 16:13 ` [PATCH 1/6] afs: Fix memory leak in afs_put_sysnames() David Howells
2020-06-09 16:13 ` David Howells [this message]
2020-06-09 16:13 ` [PATCH 3/6] afs: Fix use of BUG() David Howells
2020-06-09 16:19 ` Kees Cook
2020-06-09 16:13 ` [PATCH 4/6] afs: Fix debugging statements with %px to be %p David Howells
2020-06-09 16:18 ` Kees Cook
2020-06-09 17:08 ` Marc Dionne
2020-06-09 16:13 ` [PATCH 5/6] afs: Remove afs_zero_fid as it's not used David Howells
2020-06-09 16:13 ` [PATCH 6/6] afs: Make afs_zap_data() static David Howells
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=159171919967.3038039.17802563446058952615.stgit@warthog.procyon.org.uk \
--to=dhowells@redhat.com \
--cc=botsch@cnf.cornell.edu \
--cc=linux-afs@lists.infradead.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--subject='Re: [PATCH 2/6] afs: Fix file locking' \
/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
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).