Fix a couple coverity-spotted issues
cover Fix a couple coverity-spotted issues
<EOM>
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 1/2 xfs: Ensure we have target_ip for RENAME_EXCHANGE
We shouldn't get here with RENAME_EXCHANGE set and no target_ip, but let's be defensive, because xfs_cross_rename() will dereference it.
Spotted by Coverity.
---
fs/xfs/xfs_inode.c +4 -0
@@ -2867,6 +2867,10 @@ xfs_rename(* Handle RENAME_EXCHANGE flags */ if (flags &RENAME_EXCHANGE ) { +if (target_ip ==NULL ) { + error = -EINVAL ; + goto error_return; + } error =xfs_cross_rename (tp, src_dp, src_name, src_ip, target_dp, target_name, target_ip, &free_list, &first_block, spaceres);
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 1/2] xfs: Ensure we have target_ip for RENAME_EXCHANGE
Seems a little pointless, but given that we overload these different operations over ->rename making Coverity happy might not be the worst idea. Maybe we should just add a different ->rename_exchange methods given that there's not much shared code anywhere.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 2/2 xfs: cancel failed transaction in xfs_fs_commit_blocks()
In reply to Eric SandeenIf xfs_trans_reserve fails we don't cancel the transaction, and we'll leak the allocated transaction pointer.
Spotted by Coverity.
---
fs/xfs/xfs_pnfs.c +3 -1
@@ -300,8 +300,10 @@ xfs_fs_commit_blocks( tp =xfs_trans_alloc (mp,XFS_TRANS_SETATTR_NOT_SIZE ); error =xfs_trans_reserve (tp, &M_RES (mp)->tr_ichange,0 ,0 ); -if (error) +if (error) { +xfs_trans_cancel (tp,0 ); goto out_drop_iolock; + }xfs_ilock (ip,XFS_ILOCK_EXCL );xfs_trans_ijoin (tp, ip,XFS_ILOCK_EXCL );
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 2/2] xfs: cancel failed transaction in xfs_fs_commit_blocks()
Quoted 4 lines · Eric Sandeen
If
xfs_trans_reservefails we don't cancel the transaction, and we'll leak the allocated transaction pointer.Spotted by Coverity.
Thanks, looks good.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs