linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: zhengbin <zhengbin13@huawei.com>, Hulk Robot <hulkci@huawei.com>,
	Miklos Szeredi <mszeredi@redhat.com>,
	Sasha Levin <sashal@kernel.org>,
	linux-fsdevel@vger.kernel.org
Subject: [PATCH AUTOSEL 4.4 11/15] fuse: fix memleak in cuse_channel_open
Date: Tue,  1 Oct 2019 12:45:29 -0400	[thread overview]
Message-ID: <20191001164533.16915-11-sashal@kernel.org> (raw)
In-Reply-To: <20191001164533.16915-1-sashal@kernel.org>

From: zhengbin <zhengbin13@huawei.com>

[ 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>
---
 fs/fuse/cuse.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/fuse/cuse.c b/fs/fuse/cuse.c
index c5b6b71654893..d9aba97007267 100644
--- a/fs/fuse/cuse.c
+++ b/fs/fuse/cuse.c
@@ -513,6 +513,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;
-- 
2.20.1


  parent reply	other threads:[~2019-10-01 16:46 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-01 16:45 [PATCH AUTOSEL 4.4 01/15] ima: always return negative code for error Sasha Levin
2019-10-01 16:45 ` [PATCH AUTOSEL 4.4 02/15] fs: nfs: Fix possible null-pointer dereferences in encode_attrs() Sasha Levin
2019-10-01 16:45 ` [PATCH AUTOSEL 4.4 03/15] 9p: avoid attaching writeback_fid on mmap with type PRIVATE Sasha Levin
2019-10-01 16:45 ` [PATCH AUTOSEL 4.4 04/15] xen/pci: reserve MCFG areas earlier Sasha Levin
2019-10-01 16:45 ` [PATCH AUTOSEL 4.4 05/15] ceph: fix directories inode i_blkbits initialization Sasha Levin
2019-10-01 16:45 ` [PATCH AUTOSEL 4.4 06/15] drm/amdgpu: Check for valid number of registers to read Sasha Levin
2019-10-01 16:45 ` [PATCH AUTOSEL 4.4 07/15] cdc_ncm: fix divide-by-zero caused by invalid wMaxPacketSize Sasha Levin
2019-10-01 16:45 ` [PATCH AUTOSEL 4.4 08/15] usbnet: ignore endpoints with " Sasha Levin
2019-10-01 16:45 ` [PATCH AUTOSEL 4.4 09/15] net/phy: fix DP83865 10 Mbps HDX loopback disable function Sasha Levin
2019-10-01 16:45 ` [PATCH AUTOSEL 4.4 10/15] thermal: Fix use-after-free when unregistering thermal zone device Sasha Levin
2019-10-01 16:45 ` Sasha Levin [this message]
2019-10-01 16:45 ` [PATCH AUTOSEL 4.4 12/15] arcnet: provide a buffer big enough to actually receive packets Sasha Levin
2019-10-01 16:45 ` [PATCH AUTOSEL 4.4 13/15] kernel/elfcore.c: include proper prototypes Sasha Levin
2019-10-01 16:45 ` [PATCH AUTOSEL 4.4 14/15] usbnet: sanity checking of packet sizes and device mtu Sasha Levin
2019-10-01 16:45 ` [PATCH AUTOSEL 4.4 15/15] sch_netem: fix a divide by zero in tabledist() Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191001164533.16915-11-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=hulkci@huawei.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mszeredi@redhat.com \
    --cc=stable@vger.kernel.org \
    --cc=zhengbin13@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).