Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp43333pxx; Wed, 28 Oct 2020 17:36:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwWm7eMdIu/DmK2Cl2S8TfpspRciERAvwPKsk7M4dHaT2rIhD+jGO6Sg6HObluaXhk+aEAc X-Received: by 2002:aa7:c6c5:: with SMTP id b5mr1581488eds.259.1603931803906; Wed, 28 Oct 2020 17:36:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603931803; cv=none; d=google.com; s=arc-20160816; b=SdSviKgn3PTxW8MPa+pNf1uq7s7HPGq9GRFlRxpwnGealOa244w4x4uyhkcONVAT4N 8oSg4IlnuUr7KBK7wMStkf7WBmFAmYGLVtN67Ug01U0ghoRe1ABh2BM0lQ/sh6Asy+I6 Fup+mPigujk0uIXKyLu0sKu0PpSYDnEgxODGcHYoVyBhRbMAu7B+nJNd6Y8mSpaYqymx 4yj/JIi2w3FBQ3QceyEtJbXnE16ieQ/yDHl7B3KZ7e5MT828Q5JTQ6PhzrqyxFyo2y4Z o5iBFbF5Wsl+J5UJSl8FGWF8FJWB1cQAS23CWbACLcsAXZi/457zcgN8axbYNrW4rY9K 7Q/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :mime-version:user-agent:date:message-id:subject:cc:from:to; bh=e4MQ+x24HPAC1WlJlC1aAXHqF6olaRXH8uR+EKmZzkI=; b=AYye4U1pZRgJ5gXxipoM7OZgSmjiPi/0K2jFJmacpbC0GQmBX7IZ/u9fWwJCcJoevH jaLDw2fpbwKd5rLRh2zsJ4aK2fDUgDtb6KXQ+LZShriEg1w3nB88UyDvWJNNpAwq/Etx KOMNd5W6rxoUGOVBREQ5kC7arjG5e0Dgc1y1yXsV8PIwkEMhHWiz3su9doGDuCuBCTYq DkvaXiYmfIDOwrF5HY+1tmSRi14z5bmncq/1gkmuZQKT64/kHVTtwRIFtAXyP9LYopQO eUAFbk2O/qVQz+6E8nJF3g4t90bs/GigumrjZ4tuGyIoWb6Q/UZxrZaefvHjbKAd8Dum nxKw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z4si793201edi.573.2020.10.28.17.36.21; Wed, 28 Oct 2020 17:36:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730309AbgJ1WJZ (ORCPT + 99 others); Wed, 28 Oct 2020 18:09:25 -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-kernel@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