Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

afs: Fix vlserver record corruption

Because I made the afs_call struct share pointers to an afs_server object
and an afs_vlserver object to save space, afs_put_call() calls
afs_put_server() on afs_vlserver object (which is only meant for the
afs_server object) because it sees that call->server isn't NULL.

This means that the afs_vlserver object gets unpredictably and randomly
modified, depending on what config options are set (such as lockdep).

Fix this by getting rid of the union and having two non-overlapping
pointers in the afs_call struct.

Fixes: ffba718e9354 ("afs: Get rid of afs_call::reply[]")
Signed-off-by: David Howells <dhowells@redhat.com>

+2 -4
+2 -4
fs/afs/internal.h
··· 113 113 struct rxrpc_call *rxcall; /* RxRPC call handle */ 114 114 struct key *key; /* security for this call */ 115 115 struct afs_net *net; /* The network namespace */ 116 - union { 117 - struct afs_server *server; 118 - struct afs_vlserver *vlserver; 119 - }; 116 + struct afs_server *server; /* The fileserver record if fs op (pins ref) */ 117 + struct afs_vlserver *vlserver; /* The vlserver record if vl op */ 120 118 struct afs_cb_interest *cbi; /* Callback interest for server used */ 121 119 struct afs_vnode *lvnode; /* vnode being locked */ 122 120 void *request; /* request data (first part) */