Hi Thanks ! I will modify sign name correctly later
Sorry to say that I have no rtl8712 hardware, so that I could not test it. From Dan Carpenter's email reply, "free_netdev(adapter->pnetdev)" function may cause use after free issue So that I reply email to ensure if this return value should be check or how to handle this return value error > -----原始邮件----- > 发件人: "Greg KH" <gre...@linuxfoundation.org> > 发送时间: 2020-12-09 23:13:40 (星期三) > 收件人: shaojie.d...@isrc.iscas.ac.cn > 抄送: larry.fin...@lwfinger.net, florian.c.schilha...@googlemail.com, de...@driverdev.osuosl.org, linux-ker...@vger.kernel.org > 主题: Re: [PATCH] staging: rtl8712: check register_netdev() return value > > On Wed, Dec 09, 2020 at 11:01:24PM +0800, shaojie.d...@isrc.iscas.ac.cn wrote: > > From: "shaojie.dong" <shaojie.d...@isrc.iscas.ac.cn> > > > > Function register_netdev() can fail, so we should check it's return value > > > > Signed-off-by: shaojie.dong <shaojie.d...@isrc.iscas.ac.cn> > > I doubt you sign your name with a '.' in it, right? > > Please resend with the correct name, and using Capital letters where > needed. > > > --- > > drivers/staging/rtl8712/hal_init.c | 5 ++++- > > 1 file changed, 4 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/staging/rtl8712/hal_init.c b/drivers/staging/rtl8712/hal_init.c > > index 715f1fe8b..38a3e3d44 100644 > > --- a/drivers/staging/rtl8712/hal_init.c > > +++ b/drivers/staging/rtl8712/hal_init.c > > @@ -45,7 +45,10 @@ static void rtl871x_load_fw_cb(const struct firmware *firmware, void *context) > > } > > adapter->fw = firmware; > > /* firmware available - start netdev */ > > - register_netdev(adapter->pnetdev); > > + if (register_netdev(adapter->pnetdev) != 0) { > > + netdev_err(adapter->pnetdev, "register_netdev() failed\n"); > > + free_netdev(adapter->pnetdev); > > + } > > Did you test this to see if this really properly cleans everything up? > > And your if statement can be simplified, please do so. > > thanks, > > greg k-h </shaojie.d...@isrc.iscas.ac.cn></shaojie.d...@isrc.iscas.ac.cn></gre...@linuxfoundation.org> _______________________________________________ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel