* [PATCH AUTOSEL 4.19 33/57] blk-mq: protect debugfs_create_files() from failures
[not found] <20190330012854.32212-1-sashal@kernel.org>
@ 2019-03-30 1:28 ` Sasha Levin
2019-03-30 5:43 ` Greg Kroah-Hartman
0 siblings, 1 reply; 3+ messages in thread
From: Sasha Levin @ 2019-03-30 1:28 UTC (permalink / raw)
To: linux-kernel, stable; +Cc: Greg Kroah-Hartman, Sasha Levin, linux-block
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[ Upstream commit 36991ca68db9dd43bac7f3519f080ee3939263ef ]
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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
block/blk-mq-debugfs.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/block/blk-mq-debugfs.c b/block/blk-mq-debugfs.c
index cb1e6cf7ac48..9dc3a0896462 100644
--- a/block/blk-mq-debugfs.c
+++ b/block/blk-mq-debugfs.c
@@ -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,
const struct blk_mq_debugfs_attr *attr)
{
+ if (IS_ERR_OR_NULL(parent))
+ return false;
+
d_inode(parent)->i_private = data;
for (; attr->name; attr++) {
--
2.19.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH AUTOSEL 4.19 33/57] blk-mq: protect debugfs_create_files() from failures
2019-03-30 1:28 ` [PATCH AUTOSEL 4.19 33/57] blk-mq: protect debugfs_create_files() from failures Sasha Levin
@ 2019-03-30 5:43 ` Greg Kroah-Hartman
2019-04-03 16:17 ` Sasha Levin
0 siblings, 1 reply; 3+ messages in thread
From: Greg Kroah-Hartman @ 2019-03-30 5:43 UTC (permalink / raw)
To: Sasha Levin; +Cc: linux-kernel, stable, linux-block
On Fri, Mar 29, 2019 at 09:28:26PM -0400, Sasha Levin wrote:
> From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>
> [ Upstream commit 36991ca68db9dd43bac7f3519f080ee3939263ef ]
>
> 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>
> Signed-off-by: Sasha Levin <sashal@kernel.org>
> ---
> block/blk-mq-debugfs.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/block/blk-mq-debugfs.c b/block/blk-mq-debugfs.c
> index cb1e6cf7ac48..9dc3a0896462 100644
> --- a/block/blk-mq-debugfs.c
> +++ b/block/blk-mq-debugfs.c
> @@ -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,
> const struct blk_mq_debugfs_attr *attr)
> {
> + if (IS_ERR_OR_NULL(parent))
> + return false;
> +
> d_inode(parent)->i_private = data;
>
> for (; attr->name; attr++) {
> --
> 2.19.1
>
This was a 5.0-only thing, no need for it to be backported anywhere.
Please drop it from all of your trees.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH AUTOSEL 4.19 33/57] blk-mq: protect debugfs_create_files() from failures
2019-03-30 5:43 ` Greg Kroah-Hartman
@ 2019-04-03 16:17 ` Sasha Levin
0 siblings, 0 replies; 3+ messages in thread
From: Sasha Levin @ 2019-04-03 16:17 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: linux-kernel, stable, linux-block
On Sat, Mar 30, 2019 at 06:43:11AM +0100, Greg Kroah-Hartman wrote:
>On Fri, Mar 29, 2019 at 09:28:26PM -0400, Sasha Levin wrote:
>> From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>>
>> [ Upstream commit 36991ca68db9dd43bac7f3519f080ee3939263ef ]
>>
>> 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>
>> Signed-off-by: Sasha Levin <sashal@kernel.org>
>> ---
>> block/blk-mq-debugfs.c | 3 +++
>> 1 file changed, 3 insertions(+)
>>
>> diff --git a/block/blk-mq-debugfs.c b/block/blk-mq-debugfs.c
>> index cb1e6cf7ac48..9dc3a0896462 100644
>> --- a/block/blk-mq-debugfs.c
>> +++ b/block/blk-mq-debugfs.c
>> @@ -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,
>> const struct blk_mq_debugfs_attr *attr)
>> {
>> + if (IS_ERR_OR_NULL(parent))
>> + return false;
>> +
>> d_inode(parent)->i_private = data;
>>
>> for (; attr->name; attr++) {
>> --
>> 2.19.1
>>
>
>This was a 5.0-only thing, no need for it to be backported anywhere.
>Please drop it from all of your trees.
Dropped, thanks.
--
Thanks,
Sasha
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-04-03 16:17 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20190330012854.32212-1-sashal@kernel.org>
2019-03-30 1:28 ` [PATCH AUTOSEL 4.19 33/57] blk-mq: protect debugfs_create_files() from failures Sasha Levin
2019-03-30 5:43 ` Greg Kroah-Hartman
2019-04-03 16:17 ` Sasha Levin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox