From: Kalle Valo <kvalo@codeaurora.org>
To: Jia-Ju Bai <baijiaju1990@gmail.com>
Cc: pkshih@realtek.com, davem@davemloft.net,
linux-wireless@vger.kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, Jia-Ju Bai <baijiaju1990@gmail.com>
Subject: Re: [PATCH] rtlwifi: Fix null-pointer dereferences in error handling code of rtl_pci_probe()
Date: Tue, 28 May 2019 11:55:50 +0000 (UTC) [thread overview]
Message-ID: <20190528115555.301E760F3C@smtp.codeaurora.org> (raw)
In-Reply-To: <20190514123439.10524-1-baijiaju1990@gmail.com>
Jia-Ju Bai <baijiaju1990@gmail.com> wrote:
> *BUG 1:
> In rtl_pci_probe(), when rtlpriv->cfg->ops->init_sw_vars() fails,
> rtl_deinit_core() in the error handling code is executed.
> rtl_deinit_core() calls rtl_free_entries_from_scan_list(), which uses
> rtlpriv->scan_list.list in list_for_each_entry_safe(), but it has been
> initialized. Thus a null-pointer dereference occurs.
> The reason is that rtlpriv->scan_list.list is initialized by
> INIT_LIST_HEAD() in rtl_init_core(), which has not been called.
>
> To fix this bug, rtl_deinit_core() should not be called when
> rtlpriv->cfg->ops->init_sw_vars() fails.
>
> *BUG 2:
> In rtl_pci_probe(), rtl_init_core() can fail when rtl_regd_init() in
> this function fails, and rtlpriv->scan_list.list has not been
> initialized by INIT_LIST_HEAD(). Then, rtl_deinit_core() in the error
> handling code of rtl_pci_probe() is executed. Finally, a null-pointer
> dereference occurs due to the same reason of the above bug.
>
> To fix this bug, the initialization of lists in rtl_init_core() are
> performed before the call to rtl_regd_init().
>
> These bugs are found by a runtime fuzzing tool named FIZZER written by
> us.
>
> Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Ping & Larry, is this ok to take?
--
https://patchwork.kernel.org/patch/10942971/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
next prev parent reply other threads:[~2019-05-28 11:55 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-14 12:34 [PATCH] rtlwifi: Fix null-pointer dereferences in error handling code of rtl_pci_probe() Jia-Ju Bai
2019-05-28 11:55 ` Kalle Valo [this message]
2019-05-28 13:00 ` Larry Finger
2019-05-28 13:09 ` Kalle Valo
2019-05-29 10:30 ` Jia-Ju Bai
2019-05-29 15:48 ` Larry Finger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190528115555.301E760F3C@smtp.codeaurora.org \
--to=kvalo@codeaurora.org \
--cc=baijiaju1990@gmail.com \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pkshih@realtek.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).