summaryrefslogtreecommitdiff
path: root/fs/fuse
diff options
context:
space:
mode:
authorHangyu Hua <hbh25y@gmail.com>2023-11-16 10:57:26 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-12-20 19:00:20 +0300
commit0dc6a06c484360e5dddf920efe2cf57b7772c35a (patch)
tree82d3900dbaf568c98e8d0f2c9ecfeb13d35ca115 /fs/fuse
parent36e2497ac7ad9932f7826130fc2b3306e3db89c8 (diff)
downloadlinux-0dc6a06c484360e5dddf920efe2cf57b7772c35a.tar.xz
fuse: dax: set fc->dax to NULL in fuse_dax_conn_free()
commit 7f8ed28d1401320bcb02dda81b3c23ab2dc5a6d8 upstream. fuse_dax_conn_free() will be called when fuse_fill_super_common() fails after fuse_dax_conn_alloc(). Then deactivate_locked_super() in virtio_fs_get_tree() will call virtio_kill_sb() to release the discarded superblock. This will call fuse_dax_conn_free() again in fuse_conn_put(), resulting in a possible double free. Fixes: 1dd539577c42 ("virtiofs: add a mount option to enable dax") Signed-off-by: Hangyu Hua <hbh25y@gmail.com> Acked-by: Vivek Goyal <vgoyal@redhat.com> Reviewed-by: Jingbo Xu <jefflexu@linux.alibaba.com> Cc: <stable@vger.kernel.org> # v5.10 Signed-off-by: Miklos Szeredi <mszeredi@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/fuse')
-rw-r--r--fs/fuse/dax.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/fuse/dax.c b/fs/fuse/dax.c
index e23e802a8013..6e71904c396f 100644
--- a/fs/fuse/dax.c
+++ b/fs/fuse/dax.c
@@ -1224,6 +1224,7 @@ void fuse_dax_conn_free(struct fuse_conn *fc)
if (fc->dax) {
fuse_free_dax_mem_ranges(&fc->dax->free_ranges);
kfree(fc->dax);
+ fc->dax = NULL;
}
}