]> git.baikalelectronics.ru Git - kernel.git/commitdiff
afs: Fix file locking
authorDavid Howells <dhowells@redhat.com>
Thu, 4 Jun 2020 20:31:39 +0000 (21:31 +0100)
committerDavid Howells <dhowells@redhat.com>
Tue, 9 Jun 2020 14:22:06 +0000 (15:22 +0100)
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: 590fdde7416c ("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
fs/afs/internal.h

index 70e518f7bc19f251b5e2c0cd7cb39a41e50c5c09..71eea2a908c705561f038521a9fe074f3b7d2d80 100644 (file)
@@ -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);
index e1621b0670cc4b018f889a80d3e55cffc6f0f1cf..519ffb104616e003aad6c75ad8f64ccc3db273fc 100644 (file)
@@ -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 {