Re: [PATCH 095/190] Revert "rtlwifi: fix a potential NULL pointer dereference"

Greg Kroah-Hartman
2021-04-27T12:59:14Z

On Tue, Apr 27, 2021 at 01:21:49AM +0000, Bryan Brattlof wrote:
> On Wed, Apr 21, 2021 at 02:59:30PM +0200, Greg Kroah-Hartman wrote:
> >
> >This reverts commit 765976285a8c8db3f0eb7f033829a899d0c2786e.
> >
> >Commits from @umn.edu addresses have been found to be submitted in "bad
> >faith" to try to test the kernel community's ability to review "known
> >malicious" changes. The result of these submissions can be found in a
> >paper published at the 42nd IEEE Symposium on Security and Privacy
> >entitled, "Open Source Insecurity: Stealthily Introducing
> >Vulnerabilities via Hypocrite Commits" written by Qiushi Wu (University
> >of Minnesota) and Kangjie Lu (University of Minnesota).
> >
> >Because of this, all submissions from this group must be reverted from
> >the kernel tree and will need to be re-reviewed again to determine if
> >they actually are a valid fix. Until that work is complete, remove this
> >change to ensure that no problems are being introduced into the
> >codebase.
> >
> >Cc: Kangjie Lu <kjlu@umn.edu>
> >Cc: Kalle Valo <kvalo@codeaurora.org>
> >Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> >---
> > drivers/net/wireless/realtek/rtlwifi/base.c | 5 -----
> > 1 file changed, 5 deletions(-)
> >
> >diff --git a/drivers/net/wireless/realtek/rtlwifi/base.c b/drivers/net/wireless/realtek/rtlwifi/base.c
> >index 6e8bd99e8911..1d067536889e 100644
> >--- a/drivers/net/wireless/realtek/rtlwifi/base.c
> >+++ b/drivers/net/wireless/realtek/rtlwifi/base.c
> >@@ -452,11 +452,6 @@ static void _rtl_init_deferred_work(struct ieee80211_hw *hw)
> > /* <2> work queue */
> > rtlpriv->works.hw = hw;
> > rtlpriv->works.rtl_wq = alloc_workqueue("%s", 0, 0, rtlpriv->cfg->name);
> >- if (unlikely(!rtlpriv->works.rtl_wq)) {
> >- pr_err("Failed to allocate work queue\n");
> >- return;
> >- }
> >-
> >
>
> Hey Greg!
>
> If you're still working on this series, this patch looks to be a
> legitimate fix for the potential NULL pointer.
>
> However we should probably inform 'rtw_init_core()' of this failure in
> addition to printing about it.
>
> Do you want to apply this revert and I send a fix after this has made
> its way through?

I'll keep this revert as the "unlikely()" should never be used for
something trivial like this (the compiler and CPU does a better job),
and printing an error message also doesn't help much.

I'll fix this up with a "simpler" version that does this properly by
propagating the error backwards...

thanks,

greg k-h