afs: Fix a use after free in afs_xattr_get_acl()
authorDan Carpenter <dan.carpenter@oracle.com>
Mon, 24 Aug 2020 08:58:12 +0000 (11:58 +0300)
committerDavid Howells <dhowells@redhat.com>
Tue, 27 Oct 2020 22:05:56 +0000 (22:05 +0000)
The "op" pointer is freed earlier when we call afs_put_operation().

Fixes: e49c7b2f6de7 ("afs: Build an abstraction around an "operation" concept")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Colin Ian King <colin.king@canonical.com>

fs/afs/xattr.c

index 84f3c4f..38884d6 100644 (file)
@@ -85,7 +85,7 @@ static int afs_xattr_get_acl(const struct xattr_handler *handler,
                        if (acl->size <= size)
                                memcpy(buffer, acl->data, acl->size);
                        else
-                               op->error = -ERANGE;
+                               ret = -ERANGE;
                }
        }