summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzhengbin <zhengbin13@huawei.com>2019-08-14 10:59:09 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-10-11 19:36:42 +0300
commit410d268aa9c47465a3d60df0ee4d260b58ac105a (patch)
treef1d9f0ef5eab46384bed3d92b48806508bd6808e
parent247272bbc0911e3f583c688da5140e2fd51f16f9 (diff)
downloadlinux-410d268aa9c47465a3d60df0ee4d260b58ac105a.tar.xz
fuse: fix memleak in cuse_channel_open
[ Upstream commit 9ad09b1976c562061636ff1e01bfc3a57aebe56b ] If cuse_send_init fails, need to fuse_conn_put cc->fc. cuse_channel_open->fuse_conn_init->refcount_set(&fc->count, 1) ->fuse_dev_alloc->fuse_conn_get ->fuse_dev_free->fuse_conn_put Fixes: cc080e9e9be1 ("fuse: introduce per-instance fuse_dev structure") Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: zhengbin <zhengbin13@huawei.com> Signed-off-by: Miklos Szeredi <mszeredi@redhat.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--fs/fuse/cuse.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/fuse/cuse.c b/fs/fuse/cuse.c
index bab7a0db81dd..f3b720884650 100644
--- a/fs/fuse/cuse.c
+++ b/fs/fuse/cuse.c
@@ -519,6 +519,7 @@ static int cuse_channel_open(struct inode *inode, struct file *file)
rc = cuse_send_init(cc);
if (rc) {
fuse_dev_free(fud);
+ fuse_conn_put(&cc->fc);
return rc;
}
file->private_data = fud;