diff options
author | Eric Sandeen <sandeen@sandeen.net> | 2015-02-23 18:12:55 -0500 |
---|---|---|
committer | Dave Chinner <david@fromorbit.com> | 2015-02-23 18:12:55 -0500 |
commit | fc921566f4fcf4499e9a6d010391c00be199ab85 (patch) | |
tree | 36bac9731c9c57badb328b0721ec5d7c5d3375a8 /fs/xfs/xfs_inode.c | |
parent | 5885ebda878b47c4b4602d4b0410cb4b282af024 (diff) |
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.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Diffstat (limited to 'fs/xfs/xfs_inode.c')
-rw-r--r-- | fs/xfs/xfs_inode.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index daafa1f6d260..6163767aa856 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c | |||
@@ -2867,6 +2867,10 @@ xfs_rename( | |||
2867 | * Handle RENAME_EXCHANGE flags | 2867 | * Handle RENAME_EXCHANGE flags |
2868 | */ | 2868 | */ |
2869 | if (flags & RENAME_EXCHANGE) { | 2869 | if (flags & RENAME_EXCHANGE) { |
2870 | if (target_ip == NULL) { | ||
2871 | error = -EINVAL; | ||
2872 | goto error_return; | ||
2873 | } | ||
2870 | error = xfs_cross_rename(tp, src_dp, src_name, src_ip, | 2874 | error = xfs_cross_rename(tp, src_dp, src_name, src_ip, |
2871 | target_dp, target_name, target_ip, | 2875 | target_dp, target_name, target_ip, |
2872 | &free_list, &first_block, spaceres); | 2876 | &free_list, &first_block, spaceres); |