Skip to content

Commit a3a3769

Browse files
committed
Merge tag 'ceph-for-6.12-rc2' of https://github.com/ceph/ceph-client
Pull ceph fixes from Ilya Dryomov: "A fix from Patrick for a variety of CephFS lockup scenarios caused by a regression in cap handling which sneaked in through the netfs helper library in 5.18 (marked for stable) and an unrelated one-line cleanup" * tag 'ceph-for-6.12-rc2' of https://github.com/ceph/ceph-client: ceph: fix cap ref leak via netfs init_request ceph: use struct_size() helper in __ceph_pool_perm_get()
2 parents 79eb2c0 + ccda991 commit a3a3769

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

fs/ceph/addr.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -489,8 +489,11 @@ static int ceph_init_request(struct netfs_io_request *rreq, struct file *file)
489489
rreq->io_streams[0].sreq_max_len = fsc->mount_options->rsize;
490490

491491
out:
492-
if (ret < 0)
492+
if (ret < 0) {
493+
if (got)
494+
ceph_put_cap_refs(ceph_inode(inode), got);
493495
kfree(priv);
496+
}
494497

495498
return ret;
496499
}
@@ -2145,7 +2148,7 @@ static int __ceph_pool_perm_get(struct ceph_inode_info *ci,
21452148
}
21462149

21472150
pool_ns_len = pool_ns ? pool_ns->len : 0;
2148-
perm = kmalloc(sizeof(*perm) + pool_ns_len + 1, GFP_NOFS);
2151+
perm = kmalloc(struct_size(perm, pool_ns, pool_ns_len + 1), GFP_NOFS);
21492152
if (!perm) {
21502153
err = -ENOMEM;
21512154
goto out_unlock;

0 commit comments

Comments
 (0)