* [PATCH] cfg80211: fix debugfs rename crash
@ 2020-05-25 9:38 Johannes Berg
2020-05-25 11:10 ` Greg KH
0 siblings, 1 reply; 2+ messages in thread
From: Johannes Berg @ 2020-05-25 9:38 UTC (permalink / raw)
To: linux-wireless; +Cc: Johannes Berg, stable, syzbot+fd5332e429401bf42d18
From: Johannes Berg <johannes.berg@intel.com>
Removing the "if (IS_ERR(dir)) dir = NULL;" check only works
if we adjust the remaining code to not rely on it being NULL.
Check IS_ERR_OR_NULL() before attempting to dereference it.
I'm not actually entirely sure this fixes the syzbot crash as
the kernel config indicates that they do have DEBUG_FS in the
kernel, but this is what I found when looking there.
Cc: stable@vger.kernel.org
Fixes: d82574a8e5a4 ("cfg80211: no need to check return value of debugfs_create functions")
Reported-by: syzbot+fd5332e429401bf42d18@syzkaller.appspotmail.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
net/wireless/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/wireless/core.c b/net/wireless/core.c
index 341402b4f178..ce024440fa51 100644
--- a/net/wireless/core.c
+++ b/net/wireless/core.c
@@ -142,7 +142,7 @@ int cfg80211_dev_rename(struct cfg80211_registered_device *rdev,
if (result)
return result;
- if (rdev->wiphy.debugfsdir)
+ if (!IS_ERR_OR_NULL(rdev->wiphy.debugfsdir))
debugfs_rename(rdev->wiphy.debugfsdir->d_parent,
rdev->wiphy.debugfsdir,
rdev->wiphy.debugfsdir->d_parent, newname);
--
2.26.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] cfg80211: fix debugfs rename crash
2020-05-25 9:38 [PATCH] cfg80211: fix debugfs rename crash Johannes Berg
@ 2020-05-25 11:10 ` Greg KH
0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2020-05-25 11:10 UTC (permalink / raw)
To: Johannes Berg
Cc: linux-wireless, Johannes Berg, stable, syzbot+fd5332e429401bf42d18
On Mon, May 25, 2020 at 11:38:17AM +0200, Johannes Berg wrote:
> From: Johannes Berg <johannes.berg@intel.com>
>
> Removing the "if (IS_ERR(dir)) dir = NULL;" check only works
> if we adjust the remaining code to not rely on it being NULL.
> Check IS_ERR_OR_NULL() before attempting to dereference it.
>
> I'm not actually entirely sure this fixes the syzbot crash as
> the kernel config indicates that they do have DEBUG_FS in the
> kernel, but this is what I found when looking there.
>
> Cc: stable@vger.kernel.org
> Fixes: d82574a8e5a4 ("cfg80211: no need to check return value of debugfs_create functions")
> Reported-by: syzbot+fd5332e429401bf42d18@syzkaller.appspotmail.com
> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
> ---
> net/wireless/core.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/wireless/core.c b/net/wireless/core.c
> index 341402b4f178..ce024440fa51 100644
> --- a/net/wireless/core.c
> +++ b/net/wireless/core.c
> @@ -142,7 +142,7 @@ int cfg80211_dev_rename(struct cfg80211_registered_device *rdev,
> if (result)
> return result;
>
> - if (rdev->wiphy.debugfsdir)
> + if (!IS_ERR_OR_NULL(rdev->wiphy.debugfsdir))
> debugfs_rename(rdev->wiphy.debugfsdir->d_parent,
> rdev->wiphy.debugfsdir,
> rdev->wiphy.debugfsdir->d_parent, newname);
I missed that d_parent was being accessed, sorry about that. This looks
good to me:
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-05-25 11:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-25 9:38 [PATCH] cfg80211: fix debugfs rename crash Johannes Berg
2020-05-25 11:10 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).