From patchwork Tue Aug 9 19:19:57 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Engelmayer X-Patchwork-Id: 9272131 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7F2D26075A for ; Tue, 9 Aug 2016 19:21:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6BFA02833F for ; Tue, 9 Aug 2016 19:21:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 609D7283E2; Tue, 9 Aug 2016 19:21:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 90A3D2833F for ; Tue, 9 Aug 2016 19:20:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932519AbcHITU5 (ORCPT ); Tue, 9 Aug 2016 15:20:57 -0400 Received: from mout.gmx.net ([212.227.17.20]:59653 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932207AbcHITU4 (ORCPT ); Tue, 9 Aug 2016 15:20:56 -0400 Received: from localhost.localdomain ([81.217.123.197]) by mail.gmx.com (mrgmx103) with ESMTPSA (Nemesis) id 0LaGfK-1ane8e3ByI-00m0p4; Tue, 09 Aug 2016 21:20:30 +0200 From: Christian Engelmayer To: Larry.Finger@lwfinger.net, chaoming_li@realsil.com.cn Cc: kvalo@codeaurora.org, arnd@arndb.de, linux-wireless@vger.kernel.org, Christian Engelmayer Subject: [PATCH] rtlwifi: rtl8192de: Fix leak in _rtl92de_read_adapter_info() Date: Tue, 9 Aug 2016 21:19:57 +0200 Message-Id: <1470770397-24390-1-git-send-email-cengelma@gmx.at> X-Mailer: git-send-email 2.7.4 X-Provags-ID: V03:K0:hBM9cqwtICmiUYCd33L9APLn70XwU8FfHmuzDrpxEJEQt9w8V5v vZOCPbc6Eh2G2i/F1QE6oi4/X4DOOF+DCGT+NYDBQuqRM+fNuSWUW6moDciiwTUXv9AHGrq v5MwGsziwm7qRSiUa/OHz5+mNkwPBd03HjvnS6uHr0ba4BRNWg51nGI199MPZxls3aJFkjX ADkMk1C2O8IQIxFkKrBGg== X-UI-Out-Filterresults: notjunk:1; V01:K0:H6UBphcjbo0=:C0y/BRx97egMS8YKkaAZH/ 279gW20b27qkQ4M/t9KAqkj3cX9tU0DeaPJZrLUlnNAhxk2YSxwXDwFgMJfx2hMWmFqua5hsi BeBrzVvj4ChTT8ShBSGCdE0PEyy9yb4dE8No3sgQC5TEvmr77yzWxAHsO5UcMSB/prSQ2CNSc hdUdwJ3vp8dp2WxGebH0MMxzcbRFhJgOdHVp+yfR++UawHDijX0yLDQtEw04FGKKFqYW7VvcE OqtE1FUe4sa4KkCQkW4TUUbhIBt+iAjbpPugf8IjW0KhHqLrkVTA22lNQcSg61/lVO4WKoBGV pabQ9a4EU3XTEIR13ybrU9S3W2EI2clzGfX7/pSoyFeEXn0Ai23dlZyVNCjBfQS/Uee3UixfS lSei9bIp6HeSTuBZe1979XNBpkow21AIJR9yiBUEEReh4QMUn+J0Qjqb64fapxbcZSBlR5Tyw 5OG2M5BOP6JNuliXj7AP+7dyfmCEfaeAVEM+o3i1eDe8F/ABfP4Mbj8/4AgH3caQbG13kkDS3 OtUK8f7WTHZsiXf+0kb4A+SU+j6P7h72sLJWSyb4a6WpZwrQTwqkwURk3GvPxUm8fazoGLs4N AeaNuBdcuS2UzW5vFILubKW6GcmDY5tk9AI5ciDAxLkasuHxXUIQ01zQPOSRH56BC4QQi4pEm gUlz467MJD8gXdFtZuSeL3aXUqJuOq+EK/MbVsqi4EJYdar0YK/jB5eWD0pPnBnPy8EksyFPe ftSFmm7ZC1eplSfdzD6LD7hct//gQBdZMhBEst3Bdm9PvSk3+9K/ucCkwTQ= Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Acked-by: Larry Finger --- 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); }