Skip to content

Commit 36991ca

Browse files
committed
blk-mq: protect debugfs_create_files() from failures
If debugfs were to return a non-NULL error for a debugfs call, using that pointer later in debugfs_create_files() would crash. Fix that by properly checking the pointer before referencing it. Reported-by: Michal Hocko <mhocko@kernel.org> Reported-and-tested-by: syzbot+b382ba6a802a3d242790@syzkaller.appspotmail.com Reported-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 2c1cf00 commit 36991ca

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

block/blk-mq-debugfs.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -838,6 +838,9 @@ static const struct blk_mq_debugfs_attr blk_mq_debugfs_ctx_attrs[] = {
838838
static bool debugfs_create_files(struct dentry *parent, void *data,
839839
const struct blk_mq_debugfs_attr *attr)
840840
{
841+
if (IS_ERR_OR_NULL(parent))
842+
return false;
843+
841844
d_inode(parent)->i_private = data;
842845

843846
for (; attr->name; attr++) {

0 commit comments

Comments
 (0)