From: Dan Carpenter <dan.carpenter@oracle.com>
To: shaojie.dong@isrc.iscas.ac.cn
Cc: Larry.Finger@lwfinger.net, florian.c.schilhabel@googlemail.com,
gregkh@linuxfoundation.org, devel@driverdev.osuosl.org,
linux-kernel@vger.kernel.org
Subject: Re: Re: [PATCH] staging: rtl8712: check register_netdev() return value
Date: Thu, 10 Dec 2020 18:16:31 +0300 [thread overview]
Message-ID: <20201210151631.GN2789@kadam> (raw)
In-Reply-To: <30d377fa.20bd.1764d2f9aa8.Coremail.shaojie.dong@isrc.iscas.ac.cn>
On Thu, Dec 10, 2020 at 11:05:34PM +0800, shaojie.dong@isrc.iscas.ac.cn wrote:
> Hi
>
> >
> > This function should not be calling register_netdev(). What does that
> > have to do with firmware? It should also not free_netdev() because
> > that will just lead to a use after free in the caller.
> >
>
> --> check code history author<larry.finger@lwfinger.net> changed synchronous firmware loading to asynchronous firmware loading
> before this change, register_netdev() was not calling in firmware related function.
> For asynchronous loading, maybe register_netdev() be calling in rtl871x_load_fw_cb() is to ensure the netdev be registered after firmware loading completed
>
> --> for potential use after free issue
> Could I only call "free_irq(adapter->pnetdev->irq, adapter->pnetdev)" when register_netdev() failed ?
> If no need to change drivers/staging/rtl8712/hal_init.c file, I could give up my patch, thank you !
>
Cleaning this up is a bit complicated and requires reworking the
firmware loading and it requires testing. I don't think you have the
hardware to actually test this driver? Probably, just leave this code
for another day.
regards,
dan carpenter
next prev parent reply other threads:[~2020-12-10 15:18 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-09 15:01 [PATCH] staging: rtl8712: check register_netdev() return value shaojie.dong
2020-12-09 15:13 ` Greg KH
2020-12-10 15:15 ` shaojie.dong
2020-12-09 17:46 ` Dan Carpenter
2020-12-10 15:05 ` shaojie.dong
2020-12-10 15:16 ` Dan Carpenter [this message]
2020-12-10 15:21 ` shaojie.dong
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=20201210151631.GN2789@kadam \
--to=dan.carpenter@oracle.com \
--cc=Larry.Finger@lwfinger.net \
--cc=devel@driverdev.osuosl.org \
--cc=florian.c.schilhabel@googlemail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=shaojie.dong@isrc.iscas.ac.cn \
/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