Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp2089260ybp; Thu, 10 Oct 2019 02:00:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqzvKYK1sCDDD2U6FwXGTxCN4JUZWBp2rFTHkwXSa+c6J7TO0NTLKcgnNfCJjXTyoBh1y2kJ X-Received: by 2002:a17:906:a294:: with SMTP id i20mr6897016ejz.165.1570698049540; Thu, 10 Oct 2019 02:00:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570698049; cv=none; d=google.com; s=arc-20160816; b=m8PteYbCLLBNLiV3+6qpn19dUQNUQyHGQwRa8FkBFwMViut6GxC6DXBMeB4bEW6L+7 Au3sQoE93AkExHRmM4sZFO25BExF6Rm0HJAMTlXE3q9aI1Js3iTMKmqESadM0sBfD/Gl 5kRr1w4rsEWMQYuJOazoTrsDyu8OQkRJJ2/q6HaN6hEtkv5UiyYkozIahlXF7JrStZOV N+wGA6PfTWExsFRcMRW4sWE0ELnHB94qWQ7T6lzCR1CmlkLBNu4p4E3n7OttTOXe5j/e fXtIEpUTaDsbFD0SygWMs9xcZUfPMckRaHfUTk0lK3Ev1mSJOJ/++QNuh7kYhzs6QrOn 3MpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=WRu7gWV/ORLjx9ad3UUn4dsyy5ALZUzXJO6Iv4QlKSI=; b=t7AXZRzt6MrCZcrZOHnb4fptloKqMTyDhIxBKvQKwGg7g7RYYGV1bNe+UwooU8vNe2 p4JkqK+9KbN/0HvEhVfKgDb9vq/tsHtQoBAk5B6t46kp4uuAHmBz90SDfJbz0/byJ7ks v+93Vbzz2KZdto9wmB/yFxVGx82Ua8H0pD5Er19lBLso0rgbH/kgwIpc5upHsSEj3t4P kr3Rv8efgtHq2WvlHK1ZKNdjB3S/g/ZRuXu6Q66wZHrn/jVZXJ4633dyH3Mvh2N7agUv rTB62DHikGRACzYvq3WuJcYcNer1nGh/c7jkz1qN0yNLrUNOsFnROJU5zdm8kqnsybh+ ZmDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=USU16Gue; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b56si2916145edb.418.2019.10.10.02.00.26; Thu, 10 Oct 2019 02:00:49 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=USU16Gue; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388633AbfJJImz (ORCPT + 99 others); Thu, 10 Oct 2019 04:42:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:47490 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387966AbfJJImt (ORCPT ); Thu, 10 Oct 2019 04:42:49 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C74282190F; Thu, 10 Oct 2019 08:42:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570696969; bh=Vw4I1uOKtDXm4m/EQIyjHXit44q63Ut92gP2vIDrNS0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=USU16GueNDORsBX50TjnHMAnaWSD6PVbBBLjno+Pl9sfEdsZk4Nm3PHe5jPBpQJbI XDrJHVRw5em9AYFeEyi2L7+CLd/jxWZeJxWlvICfQM+XdttCQigkp+tO9yZSvw7HTM jokn0DY+oXcCJ6S5iTJoKxtIhLcaa70B2kc2EWao= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hulk Robot , zhengbin , Miklos Szeredi , Sasha Levin Subject: [PATCH 5.3 118/148] fuse: fix memleak in cuse_channel_open Date: Thu, 10 Oct 2019 10:36:19 +0200 Message-Id: <20191010083618.222602898@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191010083609.660878383@linuxfoundation.org> References: <20191010083609.660878383@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: zhengbin [ 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 Signed-off-by: zhengbin Signed-off-by: Miklos Szeredi Signed-off-by: Sasha Levin --- fs/fuse/cuse.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/fuse/cuse.c b/fs/fuse/cuse.c index bab7a0db81dd4..f3b7208846506 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; -- 2.20.1