From: Robin Dong Subject: [PATCH 1/2] overlayfs: fix possible leak in ovl_new_inode Date: Mon, 12 Mar 2012 13:44:58 +0800 Message-ID: <1331531099-5177-1-git-send-email-hao.bigrat@gmail.com> Cc: root , Robin Dong To: miklos@szeredi.hu, linux-fsdevel@vger.kernel.org Return-path: Received: from mail-iy0-f174.google.com ([209.85.210.174]:52516 "EHLO mail-iy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751573Ab2CLFpN (ORCPT ); Mon, 12 Mar 2012 01:45:13 -0400 Received: by iagz16 with SMTP id z16so6377041iag.19 for ; Sun, 11 Mar 2012 22:45:12 -0700 (PDT) Sender: linux-fsdevel-owner@vger.kernel.org List-ID: From: root After allocating a new inode, if the mode of inode is incorrect, we should release it by iput(). Signed-off-by: Robin Dong --- fs/overlayfs/inode.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/fs/overlayfs/inode.c b/fs/overlayfs/inode.c index ba1a777..b8ee72c 100644 --- a/fs/overlayfs/inode.c +++ b/fs/overlayfs/inode.c @@ -376,6 +376,7 @@ struct inode *ovl_new_inode(struct super_block *sb, umode_t mode, default: WARN(1, "illegal file type: %i\n", mode); + iput(inode); inode = NULL; } -- 1.7.3.2