debugfs: fix debugfs_rename parameter checking
commitc41a4650eca3880f8e8360a7a09c4fb8e2ebe14f
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 23 Jan 2019 10:27:02 +0000 (23 11:27 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 15 Feb 2019 07:11:04 +0000 (15 08:11 +0100)
tree750354e63e9db9fe4ce2a4c773ffbfedb72f5c4d
parent215f5970203a69121cb0bee6679984058d3fb60d
debugfs: fix debugfs_rename parameter checking

commit d88c93f090f708c18195553b352b9f205e65418f upstream.

debugfs_rename() needs to check that the dentries passed into it really
are valid, as sometimes they are not (i.e. if the return value of
another debugfs call is passed into this one.)  So fix this up by
properly checking if the two parent directories are errors (they are
allowed to be NULL), and if the dentry to rename is not NULL or an
error.

Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/debugfs/inode.c