From patchwork Wed Feb 1 09:06:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Johansen X-Patchwork-Id: 722402 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) by ozlabs.org (Postfix) with ESMTP id 3vCy1x3Htgz9s1h; Wed, 1 Feb 2017 20:07:17 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1cYqsk-0000kG-QV; Wed, 01 Feb 2017 09:07:14 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1cYqsa-0000e8-HM for kernel-team@lists.ubuntu.com; Wed, 01 Feb 2017 09:07:04 +0000 Received: from static-50-53-52-155.bvtn.or.frontiernet.net ([50.53.52.155] helo=canonical.com) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1cYqsZ-0003fb-RI for kernel-team@lists.ubuntu.com; Wed, 01 Feb 2017 09:07:04 +0000 From: John Johansen To: kernel-team@lists.ubuntu.com Subject: [PATCH 08/14] UBUNTU: SAUCE: apparmor: fix reference count leak when securityfs_setup_d_inode() fails Date: Wed, 1 Feb 2017 01:06:00 -0800 Message-Id: <20170201090606.22422-9-john.johansen@canonical.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170201090606.22422-1-john.johansen@canonical.com> References: <20170201090606.22422-1-john.johansen@canonical.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.14 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: kernel-team-bounces@lists.ubuntu.com BugLink: http://bugs.launchpad.net/bugs/1660845 Signed-off-by: John Johansen --- security/apparmor/apparmorfs.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c index 74ed9a9..3f1dd67 100644 --- a/security/apparmor/apparmorfs.c +++ b/security/apparmor/apparmorfs.c @@ -1052,12 +1052,12 @@ static int ns_mkdir_op(struct inode *dir, struct dentry *dentry, umode_t mode) error = securityfs_pin_fs(); inode_lock_nested(dir, I_MUTEX_PARENT); if (error) - return error; + goto out; error = __securityfs_setup_d_inode(dir, dentry, mode | S_IFDIR, NULL, NULL, NULL); if (error) - return error; + goto out; ns = aa_create_ns(parent, ACCESS_ONCE(dentry->d_name.name), dentry); if (IS_ERR(ns)) { @@ -1066,6 +1066,7 @@ static int ns_mkdir_op(struct inode *dir, struct dentry *dentry, umode_t mode) } aa_put_ns(ns); /* list ref remains */ +out: aa_put_ns(parent); return error;