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=-11.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 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 281C9C388F7 for ; Wed, 28 Oct 2020 22:09:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D13E3246C5 for ; Wed, 28 Oct 2020 22:09:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730306AbgJ1WJY (ORCPT ); Wed, 28 Oct 2020 18:09:24 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:6660 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730255AbgJ1WJA (ORCPT ); Wed, 28 Oct 2020 18:09:00 -0400 Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.60]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4CLYLp2Sfqz15M2S; Wed, 28 Oct 2020 11:04:02 +0800 (CST) Received: from [127.0.0.1] (10.174.176.238) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.487.0; Wed, 28 Oct 2020 11:03:53 +0800 To: From: Zhiqiang Liu CC: , "linux-kernel@vger.kernel.org" , Subject: [PATCH] pipe: fix potential inode leak in create_pipe_files() Message-ID: <779f767d-c08b-0c03-198e-06270100d529@huawei.com> Date: Wed, 28 Oct 2020 11:03:52 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.176.238] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org In create_pipe_files(), if alloc_file_clone() fails, we will call put_pipe_info to release pipe, and call fput() to release f. However, we donot call iput() to free inode. Signed-off-by: Zhiqiang Liu Signed-off-by: Feilong Lin --- fs/pipe.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/pipe.c b/fs/pipe.c index 0ac197658a2d..8856607fde65 100644 --- a/fs/pipe.c +++ b/fs/pipe.c @@ -924,6 +924,7 @@ int create_pipe_files(struct file **res, int flags) if (IS_ERR(res[0])) { put_pipe_info(inode, inode->i_pipe); fput(f); + iput(inode); return PTR_ERR(res[0]); } res[0]->private_data = inode->i_pipe; -- 2.19.1