{"id":2224969,"url":"http://patchwork.ozlabs.org/api/patches/2224969/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-pci/patch/20260420040940.14824-1-neilfsun@tencent.com/","project":{"id":28,"url":"http://patchwork.ozlabs.org/api/projects/28/?format=json","name":"Linux PCI development","link_name":"linux-pci","list_id":"linux-pci.vger.kernel.org","list_email":"linux-pci@vger.kernel.org","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20260420040940.14824-1-neilfsun@tencent.com>","list_archive_url":null,"date":"2026-04-20T04:09:40","name":"PCI/MSI: Fix memory leak in pci_alloc_irq_vectors_affinity INTx path","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"5a88dc405bbd3fbff3a859e236e1b832e8ba054e","submitter":{"id":77323,"url":"http://patchwork.ozlabs.org/api/people/77323/?format=json","name":"neilfsun","email":"loyou85@gmail.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linux-pci/patch/20260420040940.14824-1-neilfsun@tencent.com/mbox/","series":[{"id":500549,"url":"http://patchwork.ozlabs.org/api/series/500549/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-pci/list/?series=500549","date":"2026-04-20T04:09:40","name":"PCI/MSI: Fix memory leak in pci_alloc_irq_vectors_affinity INTx path","version":1,"mbox":"http://patchwork.ozlabs.org/series/500549/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2224969/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2224969/checks/","tags":{},"related":[],"headers":{"Return-Path":"\n <linux-pci+bounces-52742-incoming=patchwork.ozlabs.org@vger.kernel.org>","X-Original-To":["incoming@patchwork.ozlabs.org","linux-pci@vger.kernel.org"],"Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=IdJuD4gt;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c04:e001:36c::12fc:5321; helo=tor.lore.kernel.org;\n envelope-from=linux-pci+bounces-52742-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)","smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com\n header.b=\"IdJuD4gt\"","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=209.85.215.177","smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=gmail.com","smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=gmail.com"],"Received":["from tor.lore.kernel.org (tor.lore.kernel.org\n [IPv6:2600:3c04:e001:36c::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fzX841TwNz1yHB\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 20 Apr 2026 14:10:12 +1000 (AEST)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby tor.lore.kernel.org (Postfix) with ESMTP id 46555301107F\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 20 Apr 2026 04:10:03 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id DF00A21A453;\n\tMon, 20 Apr 2026 04:10:02 +0000 (UTC)","from mail-pg1-f177.google.com (mail-pg1-f177.google.com\n [209.85.215.177])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id 294E3192B75\n\tfor <linux-pci@vger.kernel.org>; Mon, 20 Apr 2026 04:10:00 +0000 (UTC)","by mail-pg1-f177.google.com with SMTP id\n 41be03b00d2f7-c736261ee8dso810715a12.1\n        for <linux-pci@vger.kernel.org>; Sun, 19 Apr 2026 21:10:00 -0700 (PDT)","from localhost.localdomain ([43.132.141.24])\n        by smtp.gmail.com with ESMTPSA id\n 41be03b00d2f7-c797702fbfcsm6800160a12.22.2026.04.19.21.09.56\n        (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256);\n        Sun, 19 Apr 2026 21:09:58 -0700 (PDT)"],"ARC-Seal":"i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1776658202; cv=none;\n b=Q1ifK7u2VuU399OvwTj+6Yuj3MBuAC3+Gp0DbdTNwZD2hFsEP+wlUCTXMhZbM85IXKbyrYQm3c5xJQcJgU36qvWqAaatzf5fAhRxM8pJLkU0jNNzEQNVazXLlDg7ec5JxFlT3+nh4AK0OA7d61TpyMllkFELq2/SMku0Qo70DgA=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1776658202; c=relaxed/simple;\n\tbh=bZ2ry1xfP2UeocaW7TLRpAHTsNMxxx+8b53nzvK38NU=;\n\th=From:To:Cc:Subject:Date:Message-ID:MIME-Version;\n b=sVRtCofY0Yd3UGufQvwyp7YMSyIGyM/eZ9hJ0F4p4RxqwAzYl7YqisMkuargbIrcn+nJUJYfKvvybpB4U0KwFfvuWgm1vtv1BB2WZ43QGA5YZ3eHErOpIJall+lpLeGz0oNUoQBv5W4KqTBZ7UMfglFY2MFmuVgNI3GEnP//8HM=","ARC-Authentication-Results":"i=1; smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=gmail.com;\n spf=pass smtp.mailfrom=gmail.com;\n dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com\n header.b=IdJuD4gt; arc=none smtp.client-ip=209.85.215.177","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=gmail.com; s=20251104; t=1776658199; x=1777262999;\n darn=vger.kernel.org;\n        h=content-transfer-encoding:mime-version:message-id:date:subject:cc\n         :to:from:from:to:cc:subject:date:message-id:reply-to;\n        bh=GG9gvbqL+uVEpWZ2SVlw3MTaiPM/Nzs0ORA3YODGzCo=;\n        b=IdJuD4gt4grt9XCk2Xya3wDnbP8uJZyLFB5gTUwvfwi1ye0dIdRTSoEAjeJhTT0OBL\n         R3EBDZKWqcTzcM6ozQmRF61CFPKJo7/7JLgv8oeVgpT5u6f1CDLlxcp9Qd/YN5/W3CgB\n         jtPmgc4pisjaaQN3j4Tqhs/1h5UKk+Z0o0bZ40XTKsnn5msOBCi85/60ChkwIf1Z03vI\n         3npaaDiLtADh1EoeDLhC2IFUnQuKEMnEy1Mi1QNCstbfGOEzmTfxhSjgRICgJwEtQ/aR\n         jO7I0+c7JZc06xIcffrWRvxNB+P7phtkCnqRzWToYX69vd5vDzpWpw/HPewGgmXy8BF2\n         zD/g==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=1e100.net; s=20251104; t=1776658199; x=1777262999;\n        h=content-transfer-encoding:mime-version:message-id:date:subject:cc\n         :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date\n         :message-id:reply-to;\n        bh=GG9gvbqL+uVEpWZ2SVlw3MTaiPM/Nzs0ORA3YODGzCo=;\n        b=PEVkEJPGoosxc0cAUHalVFeMeCOwy7+noJ8hgCCr4Pe2vy+pMQqWmiDjIpw5wPppOq\n         RS86xvCZ26Gj1vl9T1tC45FtEHYW8ywnwTSftSdnRFL7Df86hN0ykUT0h04zVDs5XUAL\n         g9uKQBhCiuc85nL9cDd6u9O4Wj7XTyNyyRE8IdNGhigWu7OHjwkH0ovdJhszpR4kZ2Gh\n         JasybeebixzDTNwQtCNDpxjRDkQkifm018CkBNtkMQrH8ZzV+HTwOF5gIM0vxcdn8Pyi\n         tpo0jozsl+t+kbNevSUrCdURos3dqLnKEVIAkszPBhVzTyQiufX6BusLWfp2W5jvJBn9\n         MLWQ==","X-Forwarded-Encrypted":"i=1;\n AFNElJ9d700cNa8oysSlDg1MGEFa9tVqrLSKhkn8G5wWYoTnvDRJ1YWqG5jqGK/lEfENWGIwH0GTh9fHR/c=@vger.kernel.org","X-Gm-Message-State":"AOJu0Yw5ZctTHJ9TKdGh2MJiKPS1TTNAiZzjrMbcUJfTpwZBe+d9DaJ1\n\tmuPZ+NWjsoog9JwvxQsRCj157ZHXhpoHwAb06SpyFu9Dr4KlpSIwWxu5","X-Gm-Gg":"AeBDievPk8+sHQd6NoLbKzTWBpUyBa4H0ABqCFGbgPMPZc3JtzCwpWA+HJdlY8tFb7n\n\tODUdIAF5SLVgO0IovgK5aErGg6UEUMy4IH/j2zjFd6a5ph7CQI+AU0nTo8wHqsik80oDOLllvfj\n\th07n7NvVeV/HQU4sE2FVsqmAyqgcIXF5nB40VfgdZKf36qniSOtYERt8FAL3j9umJNY8XSBX/cF\n\tPz78Tad03PC4aMcxIVLfM2G2tp9etIxS4Wr05GJGvhKxugzOl+pL19cLqNy98rxpSwnXOnciXBj\n\tKomRZ6L+P2loI4MzOGrqDL8YTGk1cFagNPlPA/utDCv3ikq7DfvX+La3ll8MqQvrwCl//xZPken\n\tF8QObAuoM5Os+vqi9oM1fmQngGZgX1/60MCKEBtsg8IRu/h34rhNX0shfNEn/yOG07c70I7ZKaJ\n\t9L9y8kKiBwgJRX0x78eZEW4KyPMz4b4tw8xBCdKYHSrXecZcbWh1TFQl8rLtnb6zM91x0=","X-Received":"by 2002:a05:6a20:7faa:b0:3a1:90ef:7e31 with SMTP id\n adf61e73a8af0-3a190ef81d8mr3758746637.54.1776658199433;\n        Sun, 19 Apr 2026 21:09:59 -0700 (PDT)","From":"neilfsun <loyou85@gmail.com>","X-Google-Original-From":"neilfsun <neilfsun@tencent.com>","To":"bhelgaas@google.com,\n\tshawn.lin@rock-chips.com,\n\thans.zhang@cixtech.com,\n\ttglx@kernel.org,\n\tlinux-pci@vger.kernel.org,\n\tlinux-kernel@vger.kernel.org","Cc":"neilfsun <neilfsun@tencent.com>,\n\tSun Feng <loyou85@gmail.com>","Subject":"[PATCH] PCI/MSI: Fix memory leak in pci_alloc_irq_vectors_affinity\n INTx path","Date":"Mon, 20 Apr 2026 12:09:40 +0800","Message-ID":"<20260420040940.14824-1-neilfsun@tencent.com>","X-Mailer":"git-send-email 2.52.0","Precedence":"bulk","X-Mailing-List":"linux-pci@vger.kernel.org","List-Id":"<linux-pci.vger.kernel.org>","List-Subscribe":"<mailto:linux-pci+subscribe@vger.kernel.org>","List-Unsubscribe":"<mailto:linux-pci+unsubscribe@vger.kernel.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit"},"content":"In the INTx fallback path of pci_alloc_irq_vectors_affinity(),\naffinity masks are created and never freed.\n\nSigned-off-by: neilfsun <neilfsun@tencent.com>\nSigned-off-by: Sun Feng <loyou85@gmail.com>\n---\n drivers/pci/msi/api.c | 5 ++++-\n 1 file changed, 4 insertions(+), 1 deletion(-)","diff":"diff --git a/drivers/pci/msi/api.c b/drivers/pci/msi/api.c\nindex c18559b6272c..c1377f74b8f3 100644\n--- a/drivers/pci/msi/api.c\n+++ b/drivers/pci/msi/api.c\n@@ -280,14 +280,17 @@ int pci_alloc_irq_vectors_affinity(struct pci_dev *dev, unsigned int min_vecs,\n \t/* use INTx IRQ if allowed */\n \tif (flags & PCI_IRQ_INTX) {\n \t\tif (min_vecs == 1 && dev->irq) {\n+\t\t\tstruct irq_affinity_desc *masks = NULL;\n+\n \t\t\t/*\n \t\t\t * Invoke the affinity spreading logic to ensure that\n \t\t\t * the device driver can adjust queue configuration\n \t\t\t * for the single interrupt case.\n \t\t\t */\n \t\t\tif (affd)\n-\t\t\t\tirq_create_affinity_masks(1, affd);\n+\t\t\t\tmasks = irq_create_affinity_masks(1, affd);\n \t\t\tpci_intx(dev, 1);\n+\t\t\tkfree(masks);\n \t\t\treturn 1;\n \t\t}\n \t}\n","prefixes":[]}