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

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>

authored by

Eric Sandeen and committed by
Dave Chinner
fc921566 5885ebda

+4
+4
fs/xfs/xfs_inode.c
··· 2867 2867 * Handle RENAME_EXCHANGE flags 2868 2868 */ 2869 2869 if (flags & RENAME_EXCHANGE) { 2870 + if (target_ip == NULL) { 2871 + error = -EINVAL; 2872 + goto error_return; 2873 + } 2870 2874 error = xfs_cross_rename(tp, src_dp, src_name, src_ip, 2871 2875 target_dp, target_name, target_ip, 2872 2876 &free_list, &first_block, spaceres);