rtlwifi: fix memory leak in rtl_usb_probe
PATCH 1/1 rtlwifi: fix memory leak in rtl_usb_probe
In rtl_usb_probe, a new hw is allocated via ieee80211_alloc_hw(). This allocation should be released in case of allocation failure for rtlpriv->usb_data.
--- drivers/net/wireless/realtek/rtlwifi/usb.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/wireless/realtek/rtlwifi/usb.c +3 -1
@@ -1021,8 +1021,10 @@ int rtl_usb_probe(struct usb_interface *intf, rtlpriv->hw = hw; rtlpriv->usb_data =kcalloc (RTL_USB_MAX_RX_COUNT ,sizeof (u32),GFP_KERNEL ); -if (!rtlpriv->usb_data) +if (!rtlpriv->usb_data) { +ieee80211_free_hw (hw);return -ENOMEM ; + }/* this spin lock must be initialized early */ spin_lock_init (&rtlpriv->locks.usb_lock);
Signature · 1 line
2.17.1
Quoted 5 lines
In
rtl_usb_probe, a new hw is allocated viaieee80211_alloc_hw(). This allocation should be released in case of allocation failure forrtlpriv->usb_data.Fixes a7959c1394d4 ("rtlwifi: Preallocate USB read buffers and eliminate kalloc in read routine")
Which event did trigger the sending of this patch variant after a similar change was integrated already?
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id?93616951138a598d930dcaec40f2bfd9ce43bb
https://lore.kernel.org/lkml/[email protected]/
https://lore.kernel.org/patchwork/comment/1331936/
Regards,
Markus
Oh! It's duplicate, thanks for catching that.
Quoted 15 lines · Markus Elfring
Quoted 6 lines
In
rtl_usb_probe, a new hw is allocated viaieee80211_alloc_hw(). This allocation should be released in case of allocation failure forrtlpriv->usb_data.Fixes a7959c1394d4 ("rtlwifi: Preallocate USB read buffers and eliminate kalloc in read routine")Which event did trigger the sending of this patch variant after a similar change was integrated already?
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id?93616951138a598d930dcaec40f2bfd9ce43bb
https://lore.kernel.org/lkml/[email protected]/
https://lore.kernel.org/patchwork/comment/1331936/Regards,
Markus
Signature · 1 line
Navid.