Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp11884880rwl; Tue, 3 Jan 2023 06:12:15 -0800 (PST) X-Google-Smtp-Source: AMrXdXtnsTHJKuXEKMQTZX0FIad4SVmnfTmpj+ryXL5PAn06sBxcrXPIUxKO+YpMFhK4US1l8/Tg X-Received: by 2002:a17:902:aa8f:b0:189:e55d:ec72 with SMTP id d15-20020a170902aa8f00b00189e55dec72mr44075979plr.20.1672755129143; Tue, 03 Jan 2023 06:12:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672755129; cv=none; d=google.com; s=arc-20160816; b=AOobr1gMCGJUKdThKp0ZkBJBZZDFytcuSmrCaW9vBlKrN+2a4g113mGEwGEzc3y2UU FYs7ZsQfnaUmV5/aHyXFCvGNSuAy1A+aChawMtPtVJioz/A3qIscU2sie8EpgRPVcrUs eeW6aYgKk23w99600FTXizBlGtnHkvlSWc/5ucy2H63cXpDB9e518tvZNerCOP14yM7a g4MdL8vhHSN8BTSY6cnX06gZ5QZL8cT5VzNe7Qu3wMz3u0txguymkd2+PeVpB1+u5qe+ 96VfPlNeckLq4FI7T093aeZKTfUjUiycwxlamLEkQ/S0AFV15thjX155k4ZYvR1/64xu L+9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:authenticated-by; bh=0HVUh2DjhdrEkDmlfwwWKhovX0ckojPcF0/C8edeG88=; b=aBMMRITWwHK+r4Fstnz1SLa4zhxvG91MgDtKOxPn06TiP8G6rltO7nruVZlCv7WLmG t/z+34ISfEpG+VPtbmAQQ26acwqaxtzXN5/gHHyxnz7oFbHpxf82QKAdbcOR49p4YkQp pS8eJdBlXQMoTDofNVmCfC9pbbdbDrz1/JQj08R0XB5dEa94ayl5cUY+awC+godT6FJt bJnG3YsyxvXf3e08XKvgTTXszfc4ocJRqPpo4O+i4qtpwbaqJiWJv1MFi3XlRrpqlF0c OvROoRPGFBZoSaVcDYqoBrIbnZjqetKlKs+2lLMpjxu+8U/P4LzgLuVrPz2biFHor7Og FPFA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e14-20020a170903240e00b0019257c9a24esi6662362plo.67.2023.01.03.06.12.00; Tue, 03 Jan 2023 06:12:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237775AbjACOL1 (ORCPT + 67 others); Tue, 3 Jan 2023 09:11:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237739AbjACOLY (ORCPT ); Tue, 3 Jan 2023 09:11:24 -0500 Received: from rtits2.realtek.com.tw (rtits2.realtek.com [211.75.126.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 1B355DFA0 for ; Tue, 3 Jan 2023 06:11:19 -0800 (PST) Authenticated-By: X-SpamFilter-By: ArmorX SpamTrap 5.77 with qID 303EAH2L0031424, This message is accepted by code: ctloc85258 Received: from mail.realtek.com (rtexh36506.realtek.com.tw[172.21.6.27]) by rtits2.realtek.com.tw (8.15.2/2.81/5.90) with ESMTPS id 303EAH2L0031424 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=FAIL); Tue, 3 Jan 2023 22:10:17 +0800 Received: from RTEXMBS04.realtek.com.tw (172.21.6.97) by RTEXH36506.realtek.com.tw (172.21.6.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.9; Tue, 3 Jan 2023 22:11:12 +0800 Received: from localhost (172.16.19.22) by RTEXMBS04.realtek.com.tw (172.21.6.97) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.7; Tue, 3 Jan 2023 22:11:12 +0800 From: Ping-Ke Shih To: CC: , Subject: [PATCH] wifi: rtw89: fix potential leak in rtw89_append_probe_req_ie() Date: Tue, 3 Jan 2023 22:10:54 +0800 Message-ID: <20230103141054.17372-1-pkshih@realtek.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [172.16.19.22] X-ClientProxiedBy: RTEXMBS02.realtek.com.tw (172.21.6.95) To RTEXMBS04.realtek.com.tw (172.21.6.97) X-KSE-ServerInfo: RTEXMBS04.realtek.com.tw, 9 X-KSE-AntiSpam-Interceptor-Info: trusted connection X-KSE-Antiphishing-Info: Clean X-KSE-Antiphishing-ScanningType: Deterministic X-KSE-Antiphishing-Method: None X-KSE-Antiphishing-Bases: 01/03/2023 14:02:00 X-KSE-AttachmentFiltering-Interceptor-Info: no applicable attachment filtering rules found X-KSE-Antivirus-Interceptor-Info: scan successful X-KSE-Antivirus-Info: =?big5?B?Q2xlYW4sIGJhc2VzOiAyMDIzLzEvMyCkVaTIIDAxOjA0OjAw?= X-KSE-BulkMessagesFiltering-Scan-Result: protection disabled X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Zong-Zhe Yang Do `kfree_skb(new)` before `goto out` to prevent potential leak. Fixes: 895907779752 ("rtw89: 8852a: add ieee80211_ops::hw_scan") Signed-off-by: Zong-Zhe Yang Signed-off-by: Ping-Ke Shih --- drivers/net/wireless/realtek/rtw89/fw.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/realtek/rtw89/fw.c b/drivers/net/wireless/realtek/rtw89/fw.c index 0328874a0d10e..466d8273bc2b1 100644 --- a/drivers/net/wireless/realtek/rtw89/fw.c +++ b/drivers/net/wireless/realtek/rtw89/fw.c @@ -2676,8 +2676,10 @@ static int rtw89_append_probe_req_ie(struct rtw89_dev *rtwdev, list_add_tail(&info->list, &scan_info->pkt_list[band]); ret = rtw89_fw_h2c_add_pkt_offload(rtwdev, &info->id, new); - if (ret) + if (ret) { + kfree_skb(new); goto out; + } kfree_skb(new); } -- 2.25.1