Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ceph: fix dentry leaks

Signed-off-by: Yan, Zheng <zyan@redhat.com>

authored by

Yan, Zheng and committed by
Ilya Dryomov
5cba372c 3de22be6

+6 -3
+1
fs/ceph/dir.c
··· 676 676 */ 677 677 BUG_ON(!result->d_inode); 678 678 d_instantiate(dentry, result->d_inode); 679 + d_drop(result); 679 680 return 0; 680 681 } 681 682 return PTR_ERR(result);
+5 -3
fs/ceph/inode.c
··· 1449 1449 } 1450 1450 1451 1451 if (!dn->d_inode) { 1452 - dn = splice_dentry(dn, in, NULL); 1453 - if (IS_ERR(dn)) { 1454 - err = PTR_ERR(dn); 1452 + struct dentry *realdn = splice_dentry(dn, in, NULL); 1453 + if (IS_ERR(realdn)) { 1454 + err = PTR_ERR(realdn); 1455 + d_drop(dn); 1455 1456 dn = NULL; 1456 1457 goto next_item; 1457 1458 } 1459 + dn = realdn; 1458 1460 } 1459 1461 1460 1462 di = dn->d_fsdata;