Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp5145631rwe; Tue, 18 Apr 2023 02:44:17 -0700 (PDT) X-Google-Smtp-Source: AKy350apsq16y57IIAMv73uNWZp+yvMyOxANEM8jXe8SY59Ilovk/VW+gtLE1YvwUaOKWpeXLpE2 X-Received: by 2002:a17:902:8b89:b0:19a:aa0e:2d67 with SMTP id ay9-20020a1709028b8900b0019aaa0e2d67mr1444364plb.32.1681811057466; Tue, 18 Apr 2023 02:44:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681811057; cv=none; d=google.com; s=arc-20160816; b=II1/Lh55MYmYHuJ4G335p7GPlW4jNjRbeNPJdxR1Racu5882tZL35MCmPvGxJcDO5H k91ZulSDoLgiBrEzWZZ6++fFoktQG4r9wEfk4/M+cm4+oNjSs0dVFQ56/bA4zhkxsnx9 bJYvy7DKEyUXZNSjlROQoy2tUpfHCN6ZMJd7knetaOBUkinoDP5lLgmAAJiVMU2DiNaw wyznrcUtr2e73s9LWWRQPQBcxRlKO8+BtLl4t97OPtwDn4JR3rBqjmKFYHFB2FAlAaMM 0y1SbSfJAA2ALhm7kbyenj6Y3CMdVtlaIDJbJxH11dul8NHXrNV7GEzDd5jG54562Jrq Xwyw== 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 :dkim-signature; bh=zjIB/1hotBiczxY+IJY7+/5w2JDP/8yK3LEClN1o04w=; b=oGioEspZzKczv5qHFuIOZjeU7D/JtNXV0AndxVCK0fN0vGAQ8+wcJ+KhLBbz4G7HUL ICKo9ivOHdXcM9dmfVRXVveu00nSmaZz5TRUFKWzSRm72Ouuj2F+0TErJMMDiyZz+tyr fweVMc2YG39Vn6HQaAoWz8yz0Tsn8Ll91tEsGvgjS4Of/6g2JyYjGRA0m4id7giDIevz rHdcdxtB2DNMHnlmytejhpkr4auBb9tkdn5lgWABch5PKKEMJgWUB7lK//ocSt6V0BlE bjSmLeK7Pm7jRKPbJ27fppyjZbgun2T7hBntVWuW4eU/876lyV2KVRFz7a/VzX/Qk17m 5yww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=CNgI0O5Y; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x11-20020a170902ec8b00b001960fd737b6si14775860plg.330.2023.04.18.02.44.08; Tue, 18 Apr 2023 02:44:17 -0700 (PDT) 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; dkim=pass header.i=@intel.com header.s=Intel header.b=CNgI0O5Y; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231301AbjDRJ2c (ORCPT + 63 others); Tue, 18 Apr 2023 05:28:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34368 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231296AbjDRJ2b (ORCPT ); Tue, 18 Apr 2023 05:28:31 -0400 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D578B59E8 for ; Tue, 18 Apr 2023 02:28:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1681810110; x=1713346110; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=3rwhI2BK2AWnoqQ3Cxr3cMa1fK5J8z/qLOzdyO5wz2Q=; b=CNgI0O5YOyUm91rj4UZUeE6BcoyJFliRPpuCiGh6nlM/47pZG1zxW8sN 5bKcjvdDLgIubZz+dXMcMhPek8eqTC+Qy+6XOx/pH1FprQwCqHRPP7W9/ BuYN7J+hisQVT/mybfTeMPEXKlhYDs2014ugT4SBEmHwHEmILxKqo4LKg IpWsSdJ3kVGn4zNbggFBb3vKxZrRB40uC6RkDrmpW04aep4RLWj3S95eo qfY/cjaWuXtqkb4SKktwxPYg1VybA1K5YypKi89+t/KTOp+xEjtjEEArm RaJ+b7D/UAMb1qbgPE1OnDjEdkSFwxM/gZ/MGVrmyfaFnBXp2KQPs5yxr Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10683"; a="410341154" X-IronPort-AV: E=Sophos;i="5.99,206,1677571200"; d="scan'208";a="410341154" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Apr 2023 02:28:30 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10683"; a="684511208" X-IronPort-AV: E=Sophos;i="5.99,206,1677571200"; d="scan'208";a="684511208" Received: from kadanh-mobl.ger.corp.intel.com (HELO ggreenma-mobl2.lan) ([10.214.234.12]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Apr 2023 02:28:29 -0700 From: gregory.greenman@intel.com To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Johannes Berg , Gregory Greenman Subject: [PATCH 02/11] wifi: iwlwifi: fw: fix memory leak in debugfs Date: Tue, 18 Apr 2023 12:28:05 +0300 Message-Id: <20230418122405.239e501b3b8d.I4268f87809ef91209cbcd748eee0863195e70fa2@changeid> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230418092814.1438734-1-gregory.greenman@intel.com> References: <20230418092814.1438734-1-gregory.greenman@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED 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: Johannes Berg Fix a memory leak that occurs when reading the fw_info file all the way, since we return NULL indicating no more data, but don't free the status tracking object. Fixes: 36dfe9ac6e8b ("iwlwifi: dump api version in yaml format") Signed-off-by: Johannes Berg Signed-off-by: Gregory Greenman --- drivers/net/wireless/intel/iwlwifi/fw/debugfs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/intel/iwlwifi/fw/debugfs.c b/drivers/net/wireless/intel/iwlwifi/fw/debugfs.c index 43e997283db0..607e07ed2477 100644 --- a/drivers/net/wireless/intel/iwlwifi/fw/debugfs.c +++ b/drivers/net/wireless/intel/iwlwifi/fw/debugfs.c @@ -317,8 +317,10 @@ static void *iwl_dbgfs_fw_info_seq_next(struct seq_file *seq, const struct iwl_fw *fw = priv->fwrt->fw; *pos = ++state->pos; - if (*pos >= fw->ucode_capa.n_cmd_versions) + if (*pos >= fw->ucode_capa.n_cmd_versions) { + kfree(state); return NULL; + } return state; } -- 2.38.1