Skip to contentSkip to conversation

ceph: fix a buffer leak in __ceph_setxattr()

PATCH In review Viacheslav Dubeyko 2 participants 2 messages Apr 9 – Apr 27

Subsystems (2)
lore
Share & tools
lore

Viacheslav Dubeyko

author maintainer
#0 lore raw

PATCH 1/1 ceph: fix a buffer leak in __ceph_setxattr()

From: Viacheslav Dubeyko <[email protected]>

The old_blob in __ceph_setxattr() can store ci->i_xattrs.prealloc_blob value during the retry. However, it is never called the ceph_buffer_put() for the old_blob object. This patch fixes the issue of the buffer leak.

cc Alex Markuze <[email protected]>
cc Ilya Dryomov <[email protected]>
cc Patrick Donnelly <[email protected]>
cc Ceph Development <[email protected]>
---
 fs/ceph/xattr.c | 1 +
 1 file changed, 1 insertion(+)
fs/ceph/xattr.c +1 -0
index 5f87f62091a1..c6fcbf428317 100644
@@ -1294,6 +1294,7 @@ int __ceph_setxattr(struct inode *inode, const char *name,
 
 do_sync:
 	spin_unlock(&ci->i_ceph_lock);
+	ceph_buffer_put(old_blob);
 do_sync_unlocked:
 	if (lock_snap_rwsem)
 		up_read(&mdsc->snap_rwsem);
Signature · 1 line
2.53.0
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 33 lines · Viacheslav Dubeyko

From: Viacheslav Dubeyko <[email protected]>

The old_blob in __ceph_setxattr() can store ci->i_xattrs.prealloc_blob value during the retry. However, it is never called the ceph_buffer_put() for the old_blob object. This patch fixes the issue of the buffer leak.

cc Alex Markuze <[email protected]>
cc Ilya Dryomov <[email protected]>
cc Patrick Donnelly <[email protected]>
cc Ceph Development <[email protected]>
---
 fs/ceph/xattr.c | 1 +
 1 file changed, 1 insertion(+)
fs/ceph/xattr.c +1 -1
index 5f87f62091a1..c6fcbf428317 100644
@@ -1294,6 +1294,7 @@ int __ceph_setxattr(struct inode *inode, const char *name,
 
 do_sync:
        spin_unlock(&ci->i_ceph_lock);
+       ceph_buffer_put(old_blob);
 do_sync_unlocked:
        if (lock_snap_rwsem)
                up_read(&mdsc->snap_rwsem);
--

2.53.0