From: Greg KH <gregkh@linuxfoundation.org>
To: Samasth Norway Ananda <samasth.norway.ananda@oracle.com>
Cc: dan.carpenter@linaro.org, linux-staging@lists.linux.dev,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 3/3] staging: rtl8723bs: add IS_ERR() check for kthread_run()
Date: Fri, 9 Jan 2026 05:50:41 +0100 [thread overview]
Message-ID: <2026010936-koala-recharger-ca16@gregkh> (raw)
In-Reply-To: <20260108181612.2340796-4-samasth.norway.ananda@oracle.com>
On Thu, Jan 08, 2026 at 10:16:11AM -0800, Samasth Norway Ananda wrote:
> kthread_run() returns an ERR_PTR on failure, not NULL. Without this
> check, rtl8723b_stop_thread() would later check "if
> (xmitpriv->SdioXmitThread)" which evaluates to true for error pointers,
> potentially causing issues when trying to complete or wait on an invalid
> thread. Set the pointer to NULL on failure to prevent later code from
> attempting to use an invalid thread pointer.
>
> Signed-off-by: Samasth Norway Ananda <samasth.norway.ananda@oracle.com>
> ---
> drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
> index 56ceedd5a26a..27d490204fcc 100644
> --- a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
> +++ b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
> @@ -2922,6 +2922,8 @@ void rtl8723b_start_thread(struct adapter *padapter)
> struct xmit_priv *xmitpriv = &padapter->xmitpriv;
>
> xmitpriv->SdioXmitThread = kthread_run(rtl8723bs_xmit_thread, padapter, "RTWHALXT");
> + if (IS_ERR(xmitpriv->SdioXmitThread))
> + xmitpriv->SdioXmitThread = NULL
Shouldn't the function be returning an errror if this fails instead of
relying on the pointer to be NULL?
And this is a "wrapper function" and only called in one place, why not
just get rid of it entirely? Same for rtl8723b_stop_thread()?
thanks,
greg k-h
next prev parent reply other threads:[~2026-01-09 4:50 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-08 18:16 [PATCH v2 0/3] staging: rtl8723bs: fix error handling and memory leaks Samasth Norway Ananda
2026-01-08 18:16 ` [PATCH v2 1/3] staging: rtl8723bs: fix firmware memory leak on error Samasth Norway Ananda
2026-01-09 6:14 ` Dan Carpenter
2026-01-08 18:16 ` [PATCH v2 2/3] staging: rtl8723bs: fix memory leak in rtw_cfg80211_inform_bss() Samasth Norway Ananda
2026-01-09 6:16 ` Dan Carpenter
2026-01-08 18:16 ` [PATCH v2 3/3] staging: rtl8723bs: add IS_ERR() check for kthread_run() Samasth Norway Ananda
2026-01-09 4:50 ` Greg KH [this message]
2026-01-09 6:36 ` [External] : " samasth.norway.ananda
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=2026010936-koala-recharger-ca16@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=dan.carpenter@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=samasth.norway.ananda@oracle.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