From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F283E1494B8; Mon, 12 Aug 2024 16:37:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723480663; cv=none; b=t1SwIckHkisN7GhUtZLKXx8pgZLrqI/ZjrhXlksf1Yj/D8jgjcN2WtqIkkndACztsvH8kX6yzVkkONVcLWMuNNYFlvLEo4OJtuPD52nCtbWDlOYJDMi9HQDrjChg6/yWTB5A3mtc3iMs0jyKyLnFbm0ZzZv6wmfljYr4MR1wGAg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723480663; c=relaxed/simple; bh=vT+GYHwgwik2puMfVg5gA2Pfrp3xzszbX25u9Q+wWOI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jU0zvfNNZ+2u9iWReWfOzATAJFWOOL4/AZu/AA+cN3ykfkIKKTLnsf1xOVLofiJ4IyjAY2rsZ10aOAg1zuehD+2MFVAholPCMUJ/zrs9TdOCU8W+BQG6Tqdys+L+BlNA7dHrPjP0+TcENqUCtT5egg3TKZ0VzZi5LzulHVik+ss= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=oH55WI0B; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="oH55WI0B" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 60979C32782; Mon, 12 Aug 2024 16:37:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1723480662; bh=vT+GYHwgwik2puMfVg5gA2Pfrp3xzszbX25u9Q+wWOI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oH55WI0BcRevxXG/ZTwaWeA2jKzIxkbkncm+Ykrenm3owFkpoAkYTD2OlebGYX7U/ fuHDF9wTJZ9bSt8ghjvx0BkXcNrK5BRXac3ZHscehgYQ4LlG5aALqrKZBXYzYCt5uZ P1JG628KWN3KUWMdv4GOdcIlgBimUOsGFJnNH4DM= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Michal Kubiak , Pavan Kumar Linga , Alexander Lobakin , Simon Horman , Krishneil Singh , Tony Nguyen , Jakub Kicinski Subject: [PATCH 6.10 254/263] idpf: fix memleak in vport interrupt configuration Date: Mon, 12 Aug 2024 18:04:15 +0200 Message-ID: <20240812160156.267151015@linuxfoundation.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240812160146.517184156@linuxfoundation.org> References: <20240812160146.517184156@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Michal Kubiak commit 3cc88e8405b8d55e0ff035e31971aadd6baee2b6 upstream. The initialization of vport interrupt consists of two functions: 1) idpf_vport_intr_init() where a generic configuration is done 2) idpf_vport_intr_req_irq() where the irq for each q_vector is requested. The first function used to create a base name for each interrupt using "kasprintf()" call. Unfortunately, although that call allocated memory for a text buffer, that memory was never released. Fix this by removing creating the interrupt base name in 1). Instead, always create a full interrupt name in the function 2), because there is no need to create a base name separately, considering that the function 2) is never called out of idpf_vport_intr_init() context. Fixes: d4d558718266 ("idpf: initialize interrupts and enable vport") Cc: stable@vger.kernel.org # 6.7 Signed-off-by: Michal Kubiak Reviewed-by: Pavan Kumar Linga Signed-off-by: Alexander Lobakin Reviewed-by: Simon Horman Tested-by: Krishneil Singh Signed-off-by: Tony Nguyen Link: https://patch.msgid.link/20240806220923.3359860-3-anthony.l.nguyen@intel.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/intel/idpf/idpf_txrx.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) --- a/drivers/net/ethernet/intel/idpf/idpf_txrx.c +++ b/drivers/net/ethernet/intel/idpf/idpf_txrx.c @@ -3614,13 +3614,15 @@ void idpf_vport_intr_update_itr_ena_irq( /** * idpf_vport_intr_req_irq - get MSI-X vectors from the OS for the vport * @vport: main vport structure - * @basename: name for the vector */ -static int idpf_vport_intr_req_irq(struct idpf_vport *vport, char *basename) +static int idpf_vport_intr_req_irq(struct idpf_vport *vport) { struct idpf_adapter *adapter = vport->adapter; + const char *drv_name, *if_name, *vec_name; int vector, err, irq_num, vidx; - const char *vec_name; + + drv_name = dev_driver_string(&adapter->pdev->dev); + if_name = netdev_name(vport->netdev); for (vector = 0; vector < vport->num_q_vectors; vector++) { struct idpf_q_vector *q_vector = &vport->q_vectors[vector]; @@ -3637,8 +3639,8 @@ static int idpf_vport_intr_req_irq(struc else continue; - q_vector->name = kasprintf(GFP_KERNEL, "%s-%s-%d", - basename, vec_name, vidx); + q_vector->name = kasprintf(GFP_KERNEL, "%s-%s-%s-%d", drv_name, + if_name, vec_name, vidx); err = request_irq(irq_num, idpf_vport_intr_clean_queues, 0, q_vector->name, q_vector); @@ -4148,7 +4150,6 @@ error: */ int idpf_vport_intr_init(struct idpf_vport *vport) { - char *int_name; int err; err = idpf_vport_intr_init_vec_idx(vport); @@ -4162,11 +4163,7 @@ int idpf_vport_intr_init(struct idpf_vpo if (err) goto unroll_vectors_alloc; - int_name = kasprintf(GFP_KERNEL, "%s-%s", - dev_driver_string(&vport->adapter->pdev->dev), - vport->netdev->name); - - err = idpf_vport_intr_req_irq(vport, int_name); + err = idpf_vport_intr_req_irq(vport); if (err) goto unroll_vectors_alloc;