Skip to content

Commit 9efcc4a

Browse files
dhowellstorvalds
authored andcommitted
afs: Fix unpinned address list during probing
When it's probing all of a fileserver's interfaces to find which one is best to use, afs_do_probe_fileserver() takes a lock on the server record and notes the pointer to the address list. It doesn't, however, pin the address list, so as soon as it drops the lock, there's nothing to stop the address list from being freed under us. Fix this by taking a ref on the address list inside the locked section and dropping it at the end of the function. Fixes: 3bf0fb6 ("afs: Probe multiple fileservers simultaneously") Signed-off-by: David Howells <[email protected]> Reviewed-by: Marc Dionne <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 6026894 commit 9efcc4a

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

fs/afs/fs_probe.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ static int afs_do_probe_fileserver(struct afs_net *net,
145145
read_lock(&server->fs_lock);
146146
ac.alist = rcu_dereference_protected(server->addresses,
147147
lockdep_is_held(&server->fs_lock));
148+
afs_get_addrlist(ac.alist);
148149
read_unlock(&server->fs_lock);
149150

150151
atomic_set(&server->probe_outstanding, ac.alist->nr_addrs);
@@ -163,6 +164,7 @@ static int afs_do_probe_fileserver(struct afs_net *net,
163164

164165
if (!in_progress)
165166
afs_fs_probe_done(server);
167+
afs_put_addrlist(ac.alist);
166168
return in_progress;
167169
}
168170

0 commit comments

Comments
 (0)