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

Configure Feed

Select the types of activity you want to include in your feed.

ocfs2: fix inode leak

We weren't cleaning up our inode reference on error in
ocfs2_reserve_local_alloc_bits(). Add a check for error return and iput() if
need be. Move the code to set the alloc context inode info to the end of the
function so we don't have any possibility of passing back a bad pointer.

Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>

+4 -3
+4 -3
fs/ocfs2/localalloc.c
··· 471 471 472 472 mutex_lock(&local_alloc_inode->i_mutex); 473 473 474 - ac->ac_inode = local_alloc_inode; 475 - ac->ac_which = OCFS2_AC_USE_LOCAL; 476 - 477 474 if (osb->local_alloc_state != OCFS2_LA_ENABLED) { 478 475 status = -ENOSPC; 479 476 goto bail; ··· 508 511 } 509 512 } 510 513 514 + ac->ac_inode = local_alloc_inode; 515 + ac->ac_which = OCFS2_AC_USE_LOCAL; 511 516 get_bh(osb->local_alloc_bh); 512 517 ac->ac_bh = osb->local_alloc_bh; 513 518 status = 0; 514 519 bail: 520 + if (status < 0 && local_alloc_inode) 521 + iput(local_alloc_inode); 515 522 516 523 mlog_exit(status); 517 524 return status;