virtiofs fix leak in setup
authorMiklos Szeredi <mszeredi@redhat.com>
Wed, 11 Nov 2020 16:22:31 +0000 (17:22 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 30 Dec 2020 10:53:08 +0000 (11:53 +0100)
commit941327d40d30ac345899bbcd6f9e8c50397b574f
tree7397c9a06523147a358f248b9b6115fbdd718c11
parentb14a8f29c31eee6a525c20a2210cb81ca2b28c68
virtiofs fix leak in setup

[ Upstream commit 66ab33bf6d4341574f88b511e856a73f6f2a921e ]

This can be triggered for example by adding the "-omand" mount option,
which will be rejected and virtio_fs_fill_super() will return an error.

In such a case the allocations for fuse_conn and fuse_mount will leak due
to s_root not yet being set and so ->put_super() not being called.

Fixes: a62a8ef9d97d ("virtio-fs: add virtiofs filesystem")
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/fuse/virtio_fs.c