Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751808AbdIUMSI (ORCPT ); Thu, 21 Sep 2017 08:18:08 -0400 Received: from mail-pg0-f66.google.com ([74.125.83.66]:35861 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751652AbdIUMRz (ORCPT ); Thu, 21 Sep 2017 08:17:55 -0400 X-Google-Smtp-Source: AOwi7QAMGpzFOJbvo56fsIvy5VqNvlizyatX94c+xp/TCrey8Ppw+z08VIh08QmDCiIGE8PuJgoMjQ== From: Arvind Yadav To: gregkh@linuxfoundation.org, viro@zeniv.linux.org.uk Cc: linux-kernel@vger.kernel.org Subject: [PATCH] debugfs: Add check for module parameter name Date: Thu, 21 Sep 2017 17:46:54 +0530 Message-Id: <8cf113648f45ccbf304735fcc4487adecd5b7082.1505996056.git.arvind.yadav.cs@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 758 Lines: 26 Here, start_creating() is calling by debugfs_create_dir() and debugfs_create_automount(). driver can pass name as NULL in debugfs_create_dir and debugfs_create_automount. So we need to add check for 'name'. Signed-off-by: Arvind Yadav --- fs/debugfs/inode.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c index c59f015..aa5988d 100644 --- a/fs/debugfs/inode.c +++ b/fs/debugfs/inode.c @@ -292,6 +292,9 @@ static struct dentry *start_creating(const char *name, struct dentry *parent) if (IS_ERR(parent)) return parent; + if (!name) + return ERR_PTR(-ENOMEM); + error = simple_pin_fs(&debug_fs_type, &debugfs_mount, &debugfs_mount_count); if (error) -- 1.9.1