Message ID | 20230309021636.528601-1-dzm91@hust.edu.cn (mailing list archive) |
---|---|
State | Accepted |
Commit | 48181d285623198c33bb9698992502687b258efa |
Delegated to: | Kalle Valo |
Headers | show |
Series | [v2] wifi: rtw88: fix memory leak in rtw_usb_probe() | expand |
> -----Original Message----- > From: Dongliang Mu <dzm91@hust.edu.cn> > Sent: Thursday, March 9, 2023 10:17 AM > To: Yan-Hsuan Chuang <tony0620emma@gmail.com>; Kalle Valo <kvalo@kernel.org>; David S. Miller > <davem@davemloft.net>; Eric Dumazet <edumazet@google.com>; Jakub Kicinski <kuba@kernel.org>; Paolo Abeni > <pabeni@redhat.com> > Cc: Dongliang Mu <dzm91@hust.edu.cn>; linux-wireless@vger.kernel.org; netdev@vger.kernel.org; > linux-kernel@vger.kernel.org > Subject: [PATCH v2] wifi: rtw88: fix memory leak in rtw_usb_probe() > > drivers/net/wireless/realtek/rtw88/usb.c:876 rtw_usb_probe() > warn: 'hw' from ieee80211_alloc_hw() not released on lines: 811 Can I know which tool can detect this? It would be good to mention the tool in commit message. > > Fix this by modifying return to a goto statement. > > Signed-off-by: Dongliang Mu <dzm91@hust.edu.cn> > --- > v1->v2: modify the commit title > drivers/net/wireless/realtek/rtw88/usb.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/net/wireless/realtek/rtw88/usb.c b/drivers/net/wireless/realtek/rtw88/usb.c > index 2a8336b1847a..68e1b782d199 100644 > --- a/drivers/net/wireless/realtek/rtw88/usb.c > +++ b/drivers/net/wireless/realtek/rtw88/usb.c > @@ -808,7 +808,7 @@ int rtw_usb_probe(struct usb_interface *intf, const struct usb_device_id *id) > > ret = rtw_usb_alloc_rx_bufs(rtwusb); > if (ret) > - return ret; > + goto err_release_hw; > > ret = rtw_core_init(rtwdev); > if (ret) > -- > 2.39.2
> On Mar 9, 2023, at 11:47, Ping-Ke Shih <pkshih@realtek.com> wrote: > > > >> -----Original Message----- >> From: Dongliang Mu <dzm91@hust.edu.cn> >> Sent: Thursday, March 9, 2023 10:17 AM >> To: Yan-Hsuan Chuang <tony0620emma@gmail.com>; Kalle Valo <kvalo@kernel.org>; David S. Miller >> <davem@davemloft.net>; Eric Dumazet <edumazet@google.com>; Jakub Kicinski <kuba@kernel.org>; Paolo Abeni >> <pabeni@redhat.com> >> Cc: Dongliang Mu <dzm91@hust.edu.cn>; linux-wireless@vger.kernel.org; netdev@vger.kernel.org; >> linux-kernel@vger.kernel.org >> Subject: [PATCH v2] wifi: rtw88: fix memory leak in rtw_usb_probe() >> >> drivers/net/wireless/realtek/rtw88/usb.c:876 rtw_usb_probe() >> warn: 'hw' from ieee80211_alloc_hw() not released on lines: 811 > > Can I know which tool can detect this? It would be good to mention the tool > in commit message. > Oh, Smatch, I forget to mention it. >> >> Fix this by modifying return to a goto statement. >> >> Signed-off-by: Dongliang Mu <dzm91@hust.edu.cn> >> --- >> v1->v2: modify the commit title >> drivers/net/wireless/realtek/rtw88/usb.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/net/wireless/realtek/rtw88/usb.c b/drivers/net/wireless/realtek/rtw88/usb.c >> index 2a8336b1847a..68e1b782d199 100644 >> --- a/drivers/net/wireless/realtek/rtw88/usb.c >> +++ b/drivers/net/wireless/realtek/rtw88/usb.c >> @@ -808,7 +808,7 @@ int rtw_usb_probe(struct usb_interface *intf, const struct usb_device_id *id) >> >> ret = rtw_usb_alloc_rx_bufs(rtwusb); >> if (ret) >> - return ret; >> + goto err_release_hw; >> >> ret = rtw_core_init(rtwdev); >> if (ret) >> -- >> 2.39.2
> -----Original Message----- > From: Dongliang Mu <dzm91@hust.edu.cn> > Sent: Thursday, March 9, 2023 11:53 AM > To: Ping-Ke Shih <pkshih@realtek.com> > Cc: Yan-Hsuan Chuang <tony0620emma@gmail.com>; Kalle Valo <kvalo@kernel.org>; David S. Miller > <davem@davemloft.net>; Eric Dumazet <edumazet@google.com>; Jakub Kicinski <kuba@kernel.org>; Paolo Abeni > <pabeni@redhat.com>; linux-wireless@vger.kernel.org; netdev@vger.kernel.org; > linux-kernel@vger.kernel.org > Subject: Re: [PATCH v2] wifi: rtw88: fix memory leak in rtw_usb_probe() > > > On Mar 9, 2023, at 11:47, Ping-Ke Shih <pkshih@realtek.com> wrote: > > > > > > > >> -----Original Message----- > >> From: Dongliang Mu <dzm91@hust.edu.cn> > >> Sent: Thursday, March 9, 2023 10:17 AM > >> To: Yan-Hsuan Chuang <tony0620emma@gmail.com>; Kalle Valo <kvalo@kernel.org>; David S. Miller > >> <davem@davemloft.net>; Eric Dumazet <edumazet@google.com>; Jakub Kicinski <kuba@kernel.org>; Paolo > Abeni > >> <pabeni@redhat.com> > >> Cc: Dongliang Mu <dzm91@hust.edu.cn>; linux-wireless@vger.kernel.org; netdev@vger.kernel.org; > >> linux-kernel@vger.kernel.org > >> Subject: [PATCH v2] wifi: rtw88: fix memory leak in rtw_usb_probe() > >> > >> drivers/net/wireless/realtek/rtw88/usb.c:876 rtw_usb_probe() > >> warn: 'hw' from ieee80211_alloc_hw() not released on lines: 811 > > > > Can I know which tool can detect this? It would be good to mention the tool > > in commit message. > > > > Oh, Smatch, I forget to mention it. Thanks. It seems like my smatch is too old. > > >> > >> Fix this by modifying return to a goto statement. > >> > >> Signed-off-by: Dongliang Mu <dzm91@hust.edu.cn> > >> --- > >> v1->v2: modify the commit title > >> drivers/net/wireless/realtek/rtw88/usb.c | 2 +- > >> 1 file changed, 1 insertion(+), 1 deletion(-) > >> > >> diff --git a/drivers/net/wireless/realtek/rtw88/usb.c b/drivers/net/wireless/realtek/rtw88/usb.c > >> index 2a8336b1847a..68e1b782d199 100644 > >> --- a/drivers/net/wireless/realtek/rtw88/usb.c > >> +++ b/drivers/net/wireless/realtek/rtw88/usb.c > >> @@ -808,7 +808,7 @@ int rtw_usb_probe(struct usb_interface *intf, const struct usb_device_id *id) > >> > >> ret = rtw_usb_alloc_rx_bufs(rtwusb); > >> if (ret) > >> - return ret; > >> + goto err_release_hw; > >> > >> ret = rtw_core_init(rtwdev); > >> if (ret) > >> -- > >> 2.39.2 > > > ------Please consider the environment before printing this e-mail.
> -----Original Message----- > From: Dongliang Mu <dzm91@hust.edu.cn> > Sent: Thursday, March 9, 2023 10:17 AM > To: Yan-Hsuan Chuang <tony0620emma@gmail.com>; Kalle Valo <kvalo@kernel.org>; David S. Miller > <davem@davemloft.net>; Eric Dumazet <edumazet@google.com>; Jakub Kicinski <kuba@kernel.org>; Paolo Abeni > <pabeni@redhat.com> > Cc: Dongliang Mu <dzm91@hust.edu.cn>; linux-wireless@vger.kernel.org; netdev@vger.kernel.org; > linux-kernel@vger.kernel.org > Subject: [PATCH v2] wifi: rtw88: fix memory leak in rtw_usb_probe() > > drivers/net/wireless/realtek/rtw88/usb.c:876 rtw_usb_probe() > warn: 'hw' from ieee80211_alloc_hw() not released on lines: 811 > > Fix this by modifying return to a goto statement. > > Signed-off-by: Dongliang Mu <dzm91@hust.edu.cn> Reviewed-by: Ping-Ke Shih <pkshih@realtek.com> > --- > v1->v2: modify the commit title > drivers/net/wireless/realtek/rtw88/usb.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/net/wireless/realtek/rtw88/usb.c b/drivers/net/wireless/realtek/rtw88/usb.c > index 2a8336b1847a..68e1b782d199 100644 > --- a/drivers/net/wireless/realtek/rtw88/usb.c > +++ b/drivers/net/wireless/realtek/rtw88/usb.c > @@ -808,7 +808,7 @@ int rtw_usb_probe(struct usb_interface *intf, const struct usb_device_id *id) > > ret = rtw_usb_alloc_rx_bufs(rtwusb); > if (ret) > - return ret; > + goto err_release_hw; > > ret = rtw_core_init(rtwdev); > if (ret) > -- > 2.39.2
Dongliang Mu <dzm91@hust.edu.cn> wrote: > drivers/net/wireless/realtek/rtw88/usb.c:876 rtw_usb_probe() > warn: 'hw' from ieee80211_alloc_hw() not released on lines: 811 > > Fix this by modifying return to a goto statement. > > Signed-off-by: Dongliang Mu <dzm91@hust.edu.cn> > Reviewed-by: Ping-Ke Shih <pkshih@realtek.com> Patch applied to wireless-next.git, thanks. 48181d285623 wifi: rtw88: fix memory leak in rtw_usb_probe()
diff --git a/drivers/net/wireless/realtek/rtw88/usb.c b/drivers/net/wireless/realtek/rtw88/usb.c index 2a8336b1847a..68e1b782d199 100644 --- a/drivers/net/wireless/realtek/rtw88/usb.c +++ b/drivers/net/wireless/realtek/rtw88/usb.c @@ -808,7 +808,7 @@ int rtw_usb_probe(struct usb_interface *intf, const struct usb_device_id *id) ret = rtw_usb_alloc_rx_bufs(rtwusb); if (ret) - return ret; + goto err_release_hw; ret = rtw_core_init(rtwdev); if (ret)
drivers/net/wireless/realtek/rtw88/usb.c:876 rtw_usb_probe() warn: 'hw' from ieee80211_alloc_hw() not released on lines: 811 Fix this by modifying return to a goto statement. Signed-off-by: Dongliang Mu <dzm91@hust.edu.cn> --- v1->v2: modify the commit title drivers/net/wireless/realtek/rtw88/usb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)