From nobody Mon Jun 15 23:20:19 2026 Received: from mail-pg1-f179.google.com (mail-pg1-f179.google.com [209.85.215.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2709B3E275C for ; Tue, 14 Apr 2026 12:39:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776170352; cv=none; b=YbBjsPPgXMbNUPxMnSZYhb1fr7dTdIZ/aZei3bAWQh+rQz10+pDRctHUHq7F7P4ni8+4cqZPtfrhYeva9ANdtRR9bMYjXBu6Qz++zyRA9UHCwFnkht+3oQbLLo5YenLZ/keoTPTwEn8Cb/wJyNdNpujpX95Ed5EvnPu0d6iYZqM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776170352; c=relaxed/simple; bh=lNn5jvrxlKSG0/5B/U0tSygzuJ+RkoFr9+I8Xu5aVQ8=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=f1tk1X3OPuNsOJCWq8MxF2mNhCA6Mi4Kef/bQ5k4L+rqg8k1LydNcg2ENCYjb6GnLVn5D9U0Is+FwiSMnwH6zV6cSWwbZ+A+mA7hpqikrUE9JrV+SY9NKpxG8SEqeKrraIF0TFuEyOHh/aY1euNeRRv98lmCsvBgwYIPTXwK86E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=h822cIK1; arc=none smtp.client-ip=209.85.215.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="h822cIK1" Received: by mail-pg1-f179.google.com with SMTP id 41be03b00d2f7-c79467f128cso536691a12.3 for ; Tue, 14 Apr 2026 05:39:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1776170350; x=1776775150; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=LqWzHM9f5XbHVj9TeBcnNeNR71vENRDJp955u8OEAcw=; b=h822cIK1k4F3eiz+mJo8fjedaC3pWXPCEdGjKfzrbS4PknOIpBU+cVVx4yj/J01wuT tZT1Q1wCCQa2TJXgBZWe9JP32HnTITLbOOM9D6iOOQAxecp0rAGTxywiNH7iq4U6wVD6 KpYWadKD26DVSw+zM2hVvpDrKhyK/tQT5NULB9qAe+Kp/a/A+qdHvL8SF2tyo8D3HEja AxAvkhn19HXItFJC54MwqR9Qg2sOb1Bv4yXAMju9rpFDCknsQJ2sogoxzN9ZVlJ8grVE RhHn7+FoLU+4B2Nq8ODuxUn5vgyr1zUIBP9d28SqFKfoDuXFmeimFcbpOgmFJKAhFqtA 9l6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776170350; x=1776775150; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=LqWzHM9f5XbHVj9TeBcnNeNR71vENRDJp955u8OEAcw=; b=OlegkOwk+ypNreXPzM2mDA6Mj7bGJXoLk/xfdf+8bt/WNaf/KA/Z1DBskU2lut7ErR F5sJkyjov9bDCKN0y9zh+DEVY9fZQby5JOdXP0ZIWkVpYvSobOyXp0JxSjEdx8khd6eQ kJ5IZzV5B/YRdhaBF9scUs4hAOL0o2zptKPX0Ss/wiFb/i5SC529xBAZrgWUClAOoIP0 m8og2su7Tzi41xVA0hVu5Y0dZFWeqNwbRh7q9QWS3A7JzJ0+uuUIh7P20PYIVdKb+UWM jIqTf1G0nqRFOLw7/iakLMOzAIuKoKRNw3GWo++a8KAphsovf4HhuYa9Wn3sRVGfoose KkKQ== X-Forwarded-Encrypted: i=1; AFNElJ9bWjxH/lA1DhUero+SySZDmP0xtATUPjyG74m3o0uwZvZTohAXmvZDq4n/OHMTJfVEblNWCNjiwCeLTg8=@vger.kernel.org X-Gm-Message-State: AOJu0YxUYDT5LvtBgQPNERgZ+fWYVXpNfYYijfeSad+Ur84TfkET3NG/ 5CW06dHitKUZI5HnOHJUKwIpFE43Af9D+jfCHwmLeslYg0AozSwBXgTL X-Gm-Gg: AeBDievuYvhMDiqmCa6+nBksZq9d3AGlpubvR+KwoIO5PWnvFjglqtIgQsbTyVqbCtt UQ4KZTb6XRmrhTbBupwzH0IMKeSbBB1IOgRpPqXegciEWtsvwk6HfFSqj3gmSmD7kXwfzMJE3ki 60atNvIJ8+gOnY8QDzvMw9GrXGaMUu1nLjJwN94qlyJXobhRipJUy2iPyAWXqdIycoOs81tdI94 tGMnFLq6v8n8LL8hlxLmR99luhs2Vi+rhBvi8qKCUMEa2uCboiFurt/4BQWUOv63dkdNpUNh0tj qHvVDHpHy1zyC7fqgWVHK2eGJC5f++KOMsYePyt8HkPotRjUJz58JaNjUrRaxkNkiuumhi4JeTj 46duYTqo6dTUviGgb4J9KDwg849FMdaWlSCEoekvZ0AYBfS2LkAh2c8eNyHhWIEEemiVm2+2due sZyfiV2UP4opvng5HFodIoFw== X-Received: by 2002:a17:903:3c2f:b0:2ad:d0ff:2ed4 with SMTP id d9443c01a7336-2b2d591b8cbmr174221755ad.6.1776170350383; Tue, 14 Apr 2026 05:39:10 -0700 (PDT) Received: from lgs.. ([112.224.67.108]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2b2d4dd610esm145281365ad.20.2026.04.14.05.39.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Apr 2026 05:39:09 -0700 (PDT) From: Guangshuo Li To: Srujana Challa , Bharat Bhushan , Herbert Xu , "David S. Miller" , Thorsten Blum , Guangshuo Li , Kees Cook , Lukasz Bartosik , Suheil Chandran , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org Subject: [PATCH] crypto: octeontx2: fix IRQ vector leak in otx2_cptpf_probe() Date: Tue, 14 Apr 2026 20:38:57 +0800 Message-ID: <20260414123857.3162673-1-lgs201920130244@gmail.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" otx2_cptpf_probe() allocates MSI-X vectors with pci_alloc_irq_vectors() before initializing the AF-PF mailbox, registering mailbox interrupts and setting up the PF device. When cptpf_afpf_mbox_init(), cptpf_register_afpf_mbox_intr(), cptpf_device_init(), cn10k_cptpf_lmtst_init(), otx2_cpt_init_eng_grps(), sysfs_create_group() or otx2_cpt_register_dl() fails after IRQ vectors have been allocated successfully, the function unwinds mailbox, interrupt and engine group state, but fails to free the allocated IRQ vectors. The issue was identified by a static analysis tool I developed and confirmed by manual review. Add a dedicated error path to call pci_free_irq_vectors() after pci_alloc_irq_vectors() succeeds. Fixes: 83ffcf78627f ("crypto: octeontx2 - add mailbox communication with AF= ") Cc: stable@vger.kernel.org Signed-off-by: Guangshuo Li --- drivers/crypto/marvell/octeontx2/otx2_cptpf_main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/crypto/marvell/octeontx2/otx2_cptpf_main.c b/drivers/c= rypto/marvell/octeontx2/otx2_cptpf_main.c index 346d1345f11c..059f702dbf5c 100644 --- a/drivers/crypto/marvell/octeontx2/otx2_cptpf_main.c +++ b/drivers/crypto/marvell/octeontx2/otx2_cptpf_main.c @@ -783,7 +783,7 @@ static int otx2_cptpf_probe(struct pci_dev *pdev, /* Initialize AF-PF mailbox */ err =3D cptpf_afpf_mbox_init(cptpf); if (err) - goto clear_drvdata; + goto free_irq_vectors; /* Register mailbox interrupt */ err =3D cptpf_register_afpf_mbox_intr(cptpf); if (err) @@ -826,6 +826,8 @@ static int otx2_cptpf_probe(struct pci_dev *pdev, cptpf_disable_afpf_mbox_intr(cptpf); destroy_afpf_mbox: cptpf_afpf_mbox_destroy(cptpf); +free_irq_vectors: + pci_free_irq_vectors(pdev); clear_drvdata: pci_set_drvdata(pdev, NULL); return err; --=20 2.43.0