[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <159171919967.3038039.17802563446058952615.stgit@warthog.procyon.org.uk>
Date: Tue, 09 Jun 2020 17:13:19 +0100
From: David Howells <dhowells@...hat.com>
To: linux-afs@...ts.infradead.org
Cc: Dave Botsch <botsch@....cornell.edu>,
Dave Botsch <botsch@....cornell.edu>, dhowells@...hat.com,
linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH 2/6] afs: Fix file locking
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@....cornell.edu>
Signed-off-by: David Howells <dhowells@...hat.com>
Tested-by: Dave Botsch <botsch@....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 {
Powered by blists - more mailing lists