afs: Add missing afs_put_cell()

afs_alloc_volume() needs to release the cell ref it obtained in the case of
an error.  Fix this by adding an afs_put_cell() call into the error path.

This can triggered when a lookup for a cell in a dynamic root or an
autocell mount returns an error whilst trying to look up the server (such
as ENOMEDIUM).  This results in an assertion failure oops when the module
is unloaded due to outstanding refs on a cell record.

Fixes: d2ddc776a4 ("afs: Overhaul volume and server record caching and fileserver rotation")
Signed-off-by: David Howells <dhowells@redhat.com>
cc: stable@vger.kernel.org
This commit is contained in:
David Howells 2018-02-06 09:26:27 +00:00
parent e237f98a9c
commit e44150157f

View File

@ -102,6 +102,7 @@ static struct afs_volume *afs_alloc_volume(struct afs_mount_params *params,
error_2:
afs_put_serverlist(params->net, slist);
error_1:
afs_put_cell(params->net, volume->cell);
kfree(volume);
error_0:
return ERR_PTR(ret);