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 for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20251206072948.194501-1-lihaoxiang@isrc.iscas.ac.cn>
Date: Sat,  6 Dec 2025 15:29:48 +0800
From: Haoxiang Li <lihaoxiang@...c.iscas.ac.cn>
To: xiubli@...hat.com,
	idryomov@...il.com,
	zyan@...hat.com
Cc: ceph-devel@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	Haoxiang Li <lihaoxiang@...c.iscas.ac.cn>,
	stable@...r.kernel.org
Subject: [PATCH] ceph: Drop the string reference in __ceph_pool_perm_get()

After calling ceph_get_string(), ceph_put_string() is required
to drop the reference in error paths.

Fixes: 779fe0fb8e18 ("ceph: rados pool namespace support")
Cc: stable@...r.kernel.org
Signed-off-by: Haoxiang Li <lihaoxiang@...c.iscas.ac.cn>
---
 fs/ceph/addr.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
index 322ed268f14a..690a54b4c316 100644
--- a/fs/ceph/addr.c
+++ b/fs/ceph/addr.c
@@ -2440,13 +2440,13 @@ static int __ceph_pool_perm_get(struct ceph_inode_info *ci,
 
 	err = ceph_osdc_alloc_messages(rd_req, GFP_NOFS);
 	if (err)
-		goto out_unlock;
+		goto put_string;
 
 	wr_req = ceph_osdc_alloc_request(&fsc->client->osdc, NULL,
 					 1, false, GFP_NOFS);
 	if (!wr_req) {
 		err = -ENOMEM;
-		goto out_unlock;
+		goto put_string;
 	}
 
 	wr_req->r_flags = CEPH_OSD_FLAG_WRITE;
@@ -2456,13 +2456,13 @@ static int __ceph_pool_perm_get(struct ceph_inode_info *ci,
 
 	err = ceph_osdc_alloc_messages(wr_req, GFP_NOFS);
 	if (err)
-		goto out_unlock;
+		goto put_string;
 
 	/* one page should be large enough for STAT data */
 	pages = ceph_alloc_page_vector(1, GFP_KERNEL);
 	if (IS_ERR(pages)) {
 		err = PTR_ERR(pages);
-		goto out_unlock;
+		goto put_string;
 	}
 
 	osd_req_op_raw_data_in_pages(rd_req, 0, pages, PAGE_SIZE,
@@ -2480,7 +2480,7 @@ static int __ceph_pool_perm_get(struct ceph_inode_info *ci,
 	else if (err != -EPERM) {
 		if (err == -EBLOCKLISTED)
 			fsc->blocklisted = true;
-		goto out_unlock;
+		goto put_string;
 	}
 
 	if (err2 == 0 || err2 == -EEXIST)
@@ -2489,14 +2489,14 @@ static int __ceph_pool_perm_get(struct ceph_inode_info *ci,
 		if (err2 == -EBLOCKLISTED)
 			fsc->blocklisted = true;
 		err = err2;
-		goto out_unlock;
+		goto put_string;
 	}
 
 	pool_ns_len = pool_ns ? pool_ns->len : 0;
 	perm = kmalloc(struct_size(perm, pool_ns, pool_ns_len + 1), GFP_NOFS);
 	if (!perm) {
 		err = -ENOMEM;
-		goto out_unlock;
+		goto put_string;
 	}
 
 	perm->pool = pool;
@@ -2509,6 +2509,8 @@ static int __ceph_pool_perm_get(struct ceph_inode_info *ci,
 	rb_link_node(&perm->node, parent, p);
 	rb_insert_color(&perm->node, &mdsc->pool_perm_tree);
 	err = 0;
+put_string:
+	ceph_put_string(rd_req->r_base_oloc.pool_ns);
 out_unlock:
 	up_write(&mdsc->pool_perm_rwsem);
 
-- 
2.25.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ