提交 9cd271e9 编写于 作者: G Greg Kroah-Hartman 提交者: Xie XiuQi

blk-mq: protect debugfs_create_files() from failures

mainline inclusion
from mainline-5.0-rc6
commit 36991ca68db9dd43bac7f3519f080ee3939263ef
category: bugfix
bugzilla: 9360
CVE: NA
---------------------------

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: NMichal Hocko <mhocko@kernel.org>
Reported-and-tested-by: syzbot+b382ba6a802a3d242790@syzkaller.appspotmail.com
Reported-by: NTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NYufen Yu <yuyufen@huawei.com>
Reviewed-by: NHou Tao <houtao1@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 aa4b16ee
...@@ -806,6 +806,9 @@ static const struct blk_mq_debugfs_attr blk_mq_debugfs_ctx_attrs[] = { ...@@ -806,6 +806,9 @@ static const struct blk_mq_debugfs_attr blk_mq_debugfs_ctx_attrs[] = {
static bool debugfs_create_files(struct dentry *parent, void *data, static bool debugfs_create_files(struct dentry *parent, void *data,
const struct blk_mq_debugfs_attr *attr) const struct blk_mq_debugfs_attr *attr)
{ {
if (IS_ERR_OR_NULL(parent))
return false;
d_inode(parent)->i_private = data; d_inode(parent)->i_private = data;
for (; attr->name; attr++) { for (; attr->name; attr++) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册