lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 26 Jan 2015 22:16:53 -0800
From:	Omar Sandoval <osandov@...ndov.com>
To:	Alexander Viro <viro@...iv.linux.org.uk>,
	Christoph Hellwig <hch@....de>, linux-fsdevel@...r.kernel.org,
	linux-kernel@...r.kernel.org
Cc:	Omar Sandoval <osandov@...ndov.com>
Subject: [PATCH] posix_acl: fix reference leaks in posix_acl_create

get_acl gets a reference which we must release in the error cases.

Signed-off-by: Omar Sandoval <osandov@...ndov.com>
---
 fs/posix_acl.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/fs/posix_acl.c b/fs/posix_acl.c
index 0855f77..f8f3cc2 100644
--- a/fs/posix_acl.c
+++ b/fs/posix_acl.c
@@ -555,28 +555,31 @@ posix_acl_create(struct inode *dir, umode_t *mode,
 	p = get_acl(dir, ACL_TYPE_DEFAULT);
 	if (IS_ERR(p)) {
 		if (p == ERR_PTR(-EOPNOTSUPP))
 			goto apply_umask;
 		return PTR_ERR(p);
 	}
 
 	if (!p)
 		goto apply_umask;
 
 	*acl = posix_acl_clone(p, GFP_NOFS);
-	if (!*acl)
+	if (!*acl) {
+		posix_acl_release(p);
 		return -ENOMEM;
+	}
 
 	ret = posix_acl_create_masq(*acl, mode);
 	if (ret < 0) {
 		posix_acl_release(*acl);
+		posix_acl_release(p);
 		return -ENOMEM;
 	}
 
 	if (ret == 0) {
 		posix_acl_release(*acl);
 		*acl = NULL;
 	}
 
 	if (!S_ISDIR(*mode)) {
 		posix_acl_release(p);
 		*default_acl = NULL;
-- 
2.2.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ