Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp230352pxb; Mon, 13 Sep 2021 17:48:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzgU2O1mI2YsXLz4JUHUQ6xmV0Wf16Z5zjKKzBB6V8CVaH/Kk5jcwEXd+x4j8iylgd3gygO X-Received: by 2002:a92:c5c2:: with SMTP id s2mr10321365ilt.278.1631580509076; Mon, 13 Sep 2021 17:48:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631580509; cv=none; d=google.com; s=arc-20160816; b=jBnhH8OtpLSONEbb/ukK6d9E1BIV2LDKgtwHqaGomg8L+0G3L9p/2pkI9HS69ZQeLL NtgxmT9sGwCixRiMC21Me2Kz0h/DxXRzFA6fPR1Awc3gP24GpU6fuerxvBZZskmoLGPa JJ5tUPOWlWvwlGw8EkTFcAyLOr2r/Y0dCczZKkzOp8Zxs45+Qk1aD+/L7i7N89k0g04M KB7O/pdUxsJ62HjjUVCFU++Ra3SEmlrpLIFg0Hy6aL/YmgWQlMvKPpBNzOpSD9wW5JgG 8bzPQGQOJl+Jg7EqSYvcjs3JrCfhkHYZlVRD449jYypINw7KlVmEJEz8N4A7qdzJDpZN 3EqA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dmarc-filter:sender:dkim-signature; bh=jEMSuFaCPIz2sIyxxf6/q0IS1wXTlyiBIamegErQAXk=; b=03fSGJFxFUYVdgBtt6MiGGQWNCunYlCN0SYF42CXXUcXOFBzU8I3yMRIrINKFPqU6d p6tfywjZ5yafLJo6vOtP7DW6sF+2a/iPqIrFsp7Lgri4B3Js6YM7mFO4lCLl7+TgOAps gLSIG3NXI5xAOkaV42RMSkt3UcC7HqtpgMRgou4X5A+svMFkvuAfSp4Oaypb7Dr7XLyF yODiTr2OmoXPkgyumK9pLvXx6ExxREnoNf82TZNcQWYg/yiB10tRZhkxDA/9GhAfKyLC XtnU7dl0gHLGNXC95jK5B44Ful1vzFWl8kVuP6WFpk0XqTLBtCARjK/d2ocSfiq3Pj0v 3e3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=UBEww4TA; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z17si8076696ils.47.2021.09.13.17.48.17; Mon, 13 Sep 2021 17:48:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=UBEww4TA; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346246AbhIMSEa (ORCPT + 99 others); Mon, 13 Sep 2021 14:04:30 -0400 Received: from m43-7.mailgun.net ([69.72.43.7]:30640 "EHLO m43-7.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346476AbhIMSEX (ORCPT ); Mon, 13 Sep 2021 14:04:23 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1631556187; h=Content-Transfer-Encoding: MIME-Version: References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=jEMSuFaCPIz2sIyxxf6/q0IS1wXTlyiBIamegErQAXk=; b=UBEww4TAXXsaSwbyrKtcE5tjULmXdG+yejHpXEeRXHtvX4QkGOJsRsgwaNzk+gWgVjOk9CGY reHpsxXEkiwiYPoe2Ebiydh1k26k+ex9f/UzzZOaXjpbr95qV6C8q0kkabjsEdhjBLrydulj ltCm6O+P55hHHO947A9Z4o3nzbk= X-Mailgun-Sending-Ip: 69.72.43.7 X-Mailgun-Sid: WyI3YTAwOSIsICJsaW51eC13aXJlbGVzc0B2Z2VyLmtlcm5lbC5vcmciLCAiYmU5ZTRhIl0= Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n05.prod.us-west-2.postgun.com with SMTP id 613f92598b04ef8589036f34 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Mon, 13 Sep 2021 18:03:05 GMT Sender: jouni=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 8C1D5C4360C; Mon, 13 Sep 2021 18:03:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=ALL_TRUSTED,BAYES_00,SPF_FAIL, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from jouni.codeaurora.org (85-76-72-211-nat.elisa-mobile.fi [85.76.72.211]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: jouni) by smtp.codeaurora.org (Postfix) with ESMTPSA id AA84BC43616; Mon, 13 Sep 2021 18:03:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 smtp.codeaurora.org AA84BC43616 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=fail smtp.mailfrom=codeaurora.org From: Jouni Malinen To: Kalle Valo Cc: ath11k@lists.infradead.org, linux-wireless@vger.kernel.org, Baochen Qiang , Jouni Malinen Subject: [PATCH 4/5] ath11k: Fix memory leak in ath11k_qmi_driver_event_work Date: Mon, 13 Sep 2021 21:02:45 +0300 Message-Id: <20210913180246.193388-4-jouni@codeaurora.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210913180246.193388-1-jouni@codeaurora.org> References: <20210913180246.193388-1-jouni@codeaurora.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Baochen Qiang The buffer pointed to by event is not freed in case ATH11K_FLAG_UNREGISTERING bit is set, resulting in memory leak, so fix it. Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-01720.1-QCAHSPSWPL_V1_V2_SILICONZ_LITE-1 Fixes: d5c65159f289 ("ath11k: driver for Qualcomm IEEE 802.11ax devices") Signed-off-by: Baochen Qiang Signed-off-by: Jouni Malinen --- drivers/net/wireless/ath/ath11k/qmi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath11k/qmi.c b/drivers/net/wireless/ath/ath11k/qmi.c index 7e82d03b0d87..0175e35849bf 100644 --- a/drivers/net/wireless/ath/ath11k/qmi.c +++ b/drivers/net/wireless/ath/ath11k/qmi.c @@ -2753,8 +2753,10 @@ static void ath11k_qmi_driver_event_work(struct work_struct *work) list_del(&event->list); spin_unlock(&qmi->event_lock); - if (test_bit(ATH11K_FLAG_UNREGISTERING, &ab->dev_flags)) + if (test_bit(ATH11K_FLAG_UNREGISTERING, &ab->dev_flags)) { + kfree(event); return; + } switch (event->type) { case ATH11K_QMI_EVENT_SERVER_ARRIVE: -- 2.25.1