From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 05D53C4360C for ; Thu, 10 Oct 2019 08:57:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C679820679 for ; Thu, 10 Oct 2019 08:57:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570697829; bh=rl7ZIeGi2KWZp1Bkg/Y0Ga7FW5CfX8TJo1HQJxkG2+Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=EUMMshnG3i9pDN0HYfEaTOlHLtCkb+qZ5cOBo26OAI8YCYnNGLj6l8kAIHsoo8r3T 4VPz0Xxt+FGU9OD0Fl3YiDcvE4Qh6Ho2CPgNT6rYum4m6W0gIcckGcAAgi+ICq0VOw 8kfP68O1N3c5VFrghMgFlApo9vsnsVmkXU4OkItA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389464AbfJJIrY (ORCPT ); Thu, 10 Oct 2019 04:47:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:53220 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389457AbfJJIrW (ORCPT ); Thu, 10 Oct 2019 04:47:22 -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 E8A19218AC; Thu, 10 Oct 2019 08:47:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570697239; bh=rl7ZIeGi2KWZp1Bkg/Y0Ga7FW5CfX8TJo1HQJxkG2+Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q43UK2QYNOIqvFIeQWGcqeODcL2yi3yiGezM8jSOPuIMI0rlPK9NtdoXaV+07aHGU p8TcuR0rHvR/zBtzw94ouvUOb20ba78Pw4VPGMFgjj9gH9ov/ZuTk43AI5yL+RITGL uLG8rm5fcth113wsnTy+lp8xAGF6jC9ogSQgJW/A= 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 4.19 068/114] fuse: fix memleak in cuse_channel_open Date: Thu, 10 Oct 2019 10:36:15 +0200 Message-Id: <20191010083610.960408349@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191010083544.711104709@linuxfoundation.org> References: <20191010083544.711104709@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@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 8f68181256c00..f057c213c453a 100644 --- a/fs/fuse/cuse.c +++ b/fs/fuse/cuse.c @@ -518,6 +518,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