From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752882AbbC3M7X (ORCPT ); Mon, 30 Mar 2015 08:59:23 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:43512 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750938AbbC3M7V (ORCPT ); Mon, 30 Mar 2015 08:59:21 -0400 Date: Mon, 30 Mar 2015 14:59:15 +0200 From: Greg KH To: linux-kernel@vger.kernel.org Cc: Alex Elder , Viresh Kumar Subject: [PATCH] debugfs: allow bad parent pointers to be passed in Message-ID: <20150330125915.GA1523@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If something went wrong with creating a debugfs file/symlink/directory, that value could be passed down into debugfs again as a parent dentry. To make caller code simpler, just error out if this happens, and don't crash the kernel. Reported-by: Alex Elder Cc: Viresh Kumar Signed-off-by: Greg Kroah-Hartman --- fs/debugfs/inode.c | 3 +++ 1 file changed, 3 insertions(+) --- a/fs/debugfs/inode.c +++ b/fs/debugfs/inode.c @@ -254,6 +254,9 @@ static struct dentry *start_creating(con pr_debug("debugfs: creating file '%s'\n",name); + if (IS_ERR(parent)) + return parent; + error = simple_pin_fs(&debug_fs_type, &debugfs_mount, &debugfs_mount_count); if (error)