All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christian Engelmayer <cengelma@gmx.at>
To: Larry.Finger@lwfinger.net, chaoming_li@realsil.com.cn
Cc: kvalo@codeaurora.org, arnd@arndb.de,
	linux-wireless@vger.kernel.org,
	Christian Engelmayer <cengelma@gmx.at>
Subject: [PATCH] rtlwifi: rtl8192de: Fix leak in _rtl92de_read_adapter_info()
Date: Tue,  9 Aug 2016 21:19:57 +0200	[thread overview]
Message-ID: <1470770397-24390-1-git-send-email-cengelma@gmx.at> (raw)

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(-)

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);
 }
 
-- 
2.7.4


             reply	other threads:[~2016-08-09 19:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-09 19:19 Christian Engelmayer [this message]
2016-08-10 14:10 ` [PATCH] rtlwifi: rtl8192de: Fix leak in _rtl92de_read_adapter_info() Larry Finger
2016-09-03 16:52 ` Kalle Valo

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=1470770397-24390-1-git-send-email-cengelma@gmx.at \
    --to=cengelma@gmx.at \
    --cc=Larry.Finger@lwfinger.net \
    --cc=arnd@arndb.de \
    --cc=chaoming_li@realsil.com.cn \
    --cc=kvalo@codeaurora.org \
    --cc=linux-wireless@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.