Message ID | 1470770397-24390-1-git-send-email-cengelma@gmx.at (mailing list archive) |
---|---|
State | Accepted |
Commit | a0c7858e74793242733a09a3e34356f434bc1571 |
Delegated to: | Kalle Valo |
Headers | show |
On 08/09/2016 02:19 PM, Christian Engelmayer wrote: > In case rtl_get_hwinfo() fails, the function directly returns and leaks the > already allocated hwinfo memory. Go through the correct exit path. > > Signed-off-by: Christian Engelmayer <cengelma@gmx.at> > --- > drivers/net/wireless/realtek/rtlwifi/rtl8192de/hw.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) This patch looks good. Thanks. Acked-by: Larry Finger <Larry.Finger@lwfinger.net> > > diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/hw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/hw.c > index b0f632462335..57205514801c 100644 > --- a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/hw.c > +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/hw.c > @@ -1757,7 +1757,7 @@ static void _rtl92de_read_adapter_info(struct ieee80211_hw *hw) > return; > > if (rtl_get_hwinfo(hw, rtlpriv, HWSET_MAX_SIZE, hwinfo, params)) > - return; > + goto exit; > > _rtl92de_efuse_update_chip_version(hw); > _rtl92de_read_macphymode_and_bandtype(hw, hwinfo); > @@ -1790,6 +1790,7 @@ static void _rtl92de_read_adapter_info(struct ieee80211_hw *hw) > break; > } > rtlefuse->txpwr_fromeprom = true; > +exit: > kfree(hwinfo); > } > > -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Christian Engelmayer <cengelma@gmx.at> wrote: > In case rtl_get_hwinfo() fails, the function directly returns and leaks the > already allocated hwinfo memory. Go through the correct exit path. > > Signed-off-by: Christian Engelmayer <cengelma@gmx.at> > Acked-by: Larry Finger <Larry.Finger@lwfinger.net> Thanks, 1 patch applied to wireless-drivers-next.git: a0c7858e7479 rtlwifi: rtl8192de: Fix leak in _rtl92de_read_adapter_info()
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/hw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/hw.c index b0f632462335..57205514801c 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/hw.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/hw.c @@ -1757,7 +1757,7 @@ static void _rtl92de_read_adapter_info(struct ieee80211_hw *hw) return; if (rtl_get_hwinfo(hw, rtlpriv, HWSET_MAX_SIZE, hwinfo, params)) - return; + goto exit; _rtl92de_efuse_update_chip_version(hw); _rtl92de_read_macphymode_and_bandtype(hw, hwinfo); @@ -1790,6 +1790,7 @@ static void _rtl92de_read_adapter_info(struct ieee80211_hw *hw) break; } rtlefuse->txpwr_fromeprom = true; +exit: kfree(hwinfo); }
In case rtl_get_hwinfo() fails, the function directly returns and leaks the already allocated hwinfo memory. Go through the correct exit path. Signed-off-by: Christian Engelmayer <cengelma@gmx.at> --- drivers/net/wireless/realtek/rtlwifi/rtl8192de/hw.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)