| To: | xfs-oss <xfs@xxxxxxxxxxx> |
|---|---|
| Subject: | [PATCH 1/2] xfs: Ensure we have target_ip for RENAME_EXCHANGE |
| From: | Eric Sandeen <sandeen@xxxxxxxxxxx> |
| Date: | Mon, 23 Feb 2015 12:59:11 -0600 |
| Cc: | Carlos Maiolino <cmaiolin@xxxxxxxxxx> |
| Delivered-to: | xfs@xxxxxxxxxxx |
| In-reply-to: | <54EB782F.8020201@xxxxxxxxxx> |
| References: | <54EB782F.8020201@xxxxxxxxxx> |
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.
Signed-off-by: Eric Sandeen <sandeen@xxxxxxxxxx>
---
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index daafa1f..6163767 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -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);
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | [PATCH 0/2] Fix a couple coverity-spotted issues, Eric Sandeen |
|---|---|
| Next by Date: | [PATCH 2/2] xfs: cancel failed transaction in xfs_fs_commit_blocks(), Eric Sandeen |
| Previous by Thread: | [PATCH 0/2] Fix a couple coverity-spotted issues, Eric Sandeen |
| Next by Thread: | Re: [PATCH 1/2] xfs: Ensure we have target_ip for RENAME_EXCHANGE, Christoph Hellwig |
| Indexes: | [Date] [Thread] [Top] [All Lists] |