Skip to contentSkip to conversation

idpf: Fix vport IRQ name leak on request failure

PATCH In review Yuho Choi 4 participants 4 messages Oct 4 – Nov 2

Subsystems (3)
lore
Share & tools
lore

Yuho Choi

author
#0 lore raw

PATCH v2 1/1 idpf: Fix vport IRQ name leak on request failure

idpf_vport_intr_req_irq() allocates a name for each vector IRQ before calling request_irq(). On success, the name is released later through kfree(free_irq()), but when request_irq() fails, the error path only unwinds the previous vectors and the name for the failed one is leaked.

Free the allocated name on the request_irq() failure path, as done for the mailbox IRQ in commit 9bff30482c10 ("idpf: Fix mailbox IRQ name leak on request failure"). While at it, fail with -ENOMEM when the name cannot be allocated instead of requesting the IRQ without a name.

Fixes d4d558718266 ("idpf: initialize interrupts and enable vport")

---
Changes in v2:
- Correct the Fixes: tag (Simon Horman)
- Handle kasprintf() failure (Simon Horman)

v1: https://lore.kernel.org/all/[email protected]/

Compile-tested only (x86_64 defconfig + CONFIG_IDPF=m, W=1).

 drivers/net/ethernet/intel/idpf/idpf_txrx.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/net/ethernet/intel/idpf/idpf_txrx.c +5 -0
index 4311ffa30bb1..af3213eae393 100644
@@ -4067,12 +4067,17 @@ static int idpf_vport_intr_req_irq(struct idpf_vport *vport,
 
 		name = kasprintf(GFP_KERNEL, "%s-%s-%s-%d", drv_name, if_name,
 				 vec_name, vector);
+		if (!name) {
+			err = -ENOMEM;
+			goto free_q_irqs;
+		}
 
 		err = request_irq(irq_num, idpf_vport_intr_clean_queues, 0,
 				  name, q_vector);
 		if (err) {
 			netdev_err(vport->netdev,
 				   "Request_irq failed, error: %d\n", err);
+			kfree(name);
 			goto free_q_irqs;
 		}
 

base-commit: 551c722f40809618230001baccf219193e22fc5a

Signature · 1 line
2.43.0
#1 lore raw
This is an automated message. This series looks like a fix, but its commit messages seem to be missing some information:

Hi!

This is an automated message. This series looks like a fix, but its commit messages seem to be missing some information:

- How the issue was discovered, e.g. hit in production, hit during development, syzbot report, manual code inspection, LLM or static analysis tool scan.

Please do not repost the series just to address the above. Instead, reply to this email with the missing information, so that reviewers can take it into account. If the series needs another revision for other reasons, please include the information in the commit messages then.

The evaluation is done by an LLM so it may be wrong, if you think that is the case please reply and explain.

Reviewed-by on v2 1/1
#2 lore raw
In reply to Yuho Choi
Quoted 72 lines

-----Original Message-----
From: Yuho Choi <[email protected]>
Sent: Sunday, October 4, 2026 8:09 PM
To: Nguyen, Anthony L <[email protected]>; Kitszel, Przemyslaw <[email protected]>
Cc: Simon Horman <[email protected]>; Lobakin, Aleksander <[email protected]>; Hay, Joshua A <[email protected]>; Alan Brady <[email protected]>; Samudrala, Sridhar <[email protected]>; Burra, Phani R <[email protected]>; Andrew Lunn <[email protected]>; David S . Miller <[email protected]>; Eric Dumazet <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>; [email protected]; [email protected]; linux- [email protected]; Yuho Choi <[email protected]>
Subject: [PATCH net v2] idpf: Fix vport IRQ name leak on request failure

idpf_vport_intr_req_irq() allocates a name for each vector IRQ before calling request_irq(). On success, the name is released later through kfree(free_irq()), but when request_irq() fails, the error path only unwinds the previous vectors and the name for the failed one is leaked.

Free the allocated name on the request_irq() failure path, as done for the mailbox IRQ in commit 9bff30482c10 ("idpf: Fix mailbox IRQ name leak on request failure"). While at it, fail with -ENOMEM when the name cannot be allocated instead of requesting the IRQ without a name.

Fixes d4d558718266 ("idpf: initialize interrupts and enable vport")

---
Changes in v2:
- Correct the Fixes: tag (Simon Horman)
- Handle kasprintf() failure (Simon Horman)

v1: https://lore.kernel.org/all/20260923234819.702327-1-
[email protected]/

Compile-tested only (x86_64 defconfig + CONFIG_IDPF=m, W=1).

 drivers/net/ethernet/intel/idpf/idpf_txrx.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/net/ethernet/intel/idpf/idpf_txrx.c +5 -0
index 4311ffa30bb1..af3213eae393 100644
@@ -4067,12 +4067,17 @@ static int idpf_vport_intr_req_irq(struct
 idpf_vport *vport,
 
 		name = kasprintf(GFP_KERNEL, "%s-%s-%s-%d", drv_name,
 if_name,
 				 vec_name, vector);
+		if (!name) {
+			err = -ENOMEM;
+			goto free_q_irqs;
+		}
 
 		err = request_irq(irq_num, idpf_vport_intr_clean_queues,
 0,
 				  name, q_vector);
 		if (err) {
 			netdev_err(vport->netdev,
 				   "Request_irq failed, error: %d\n", err);
+			kfree(name);
drivers/net/ethernet/intel/idpf/idpf_txrx.c +0 -0
 			goto free_q_irqs;
 		}
Quoted 3 lines

base-commit: 551c722f40809618230001baccf219193e22fc5a --
2.43.0

#3 lore raw
Quoted 87 lines

-----Original Message-----
From: Loktionov, Aleksandr <[email protected]>
Sent: Monday, October 5, 2026 12:22 PM
To: Yuho Choi <[email protected]>; Nguyen, Anthony L <[email protected]>; Kitszel, Przemyslaw <[email protected]>
Cc: Simon Horman <[email protected]>; Lobakin, Aleksander <[email protected]>; Hay, Joshua A <[email protected]>; Alan Brady <[email protected]>; Samudrala, Sridhar <[email protected]>; Burra, Phani R <[email protected]>; Andrew Lunn <[email protected]>; David S . Miller <[email protected]>; Eric Dumazet <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>; intel-wired- [email protected]; [email protected]; [email protected]
Subject: RE: [PATCH net v2] idpf: Fix vport IRQ name leak on request failure

Quoted 49 lines

-----Original Message-----
From: Yuho Choi <[email protected]>
Sent: Sunday, October 4, 2026 8:09 PM
To: Nguyen, Anthony L <[email protected]>; Kitszel, Przemyslaw <[email protected]>
Cc: Simon Horman <[email protected]>; Lobakin, Aleksander <[email protected]>; Hay, Joshua A <[email protected]>; Alan Brady <[email protected]>; Samudrala, Sridhar <[email protected]>; Burra, Phani R <[email protected]>; Andrew Lunn <[email protected]>; David S . Miller <[email protected]>; Eric Dumazet <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>; [email protected]; [email protected]; linux- [email protected]; Yuho Choi <[email protected]>
Subject: [PATCH net v2] idpf: Fix vport IRQ name leak on request failure

idpf_vport_intr_req_irq() allocates a name for each vector IRQ before calling request_irq(). On success, the name is released later through kfree(free_irq()), but when request_irq() fails, the error path only unwinds the previous vectors and the name for the failed one is leaked.

Free the allocated name on the request_irq() failure path, as done for the mailbox IRQ in commit 9bff30482c10 ("idpf: Fix mailbox IRQ name leak on request failure"). While at it, fail with -ENOMEM when the name cannot be allocated instead of requesting the IRQ without a name.

Fixes d4d558718266 ("idpf: initialize interrupts and enable vport")

---
Changes in v2:
- Correct the Fixes: tag (Simon Horman)
- Handle kasprintf() failure (Simon Horman)

v1: https://lore.kernel.org/all/20260923234819.702327-1-
[email protected]/

Compile-tested only (x86_64 defconfig + CONFIG_IDPF=m, W=1).

 drivers/net/ethernet/intel/idpf/idpf_txrx.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/net/ethernet/intel/idpf/idpf_txrx.c +0 -0
index 4311ffa30bb1..af3213eae393 100644

drivers/net/ethernet/intel/idpf/idpf_txrx.c static int idpf_vport_intr_req_irq(struct · line 4069

Quoted 3 lines
drivers/net/ethernet/intel/idpf/idpf_txrx.c +0 -0
@@ -4067,12 +4067,17 @@ static int idpf_vport_intr_req_irq(struct
 idpf_vport *vport,
 
 		name = kasprintf(GFP_KERNEL, "%s-%s-%s-%d", drv_name,

if_name,

Quoted 16 lines
drivers/net/ethernet/intel/idpf/idpf_txrx.c +5 -0
 				 vec_name, vector);
+		if (!name) {
+			err = -ENOMEM;
+			goto free_q_irqs;
+		}
 
 		err = request_irq(irq_num, idpf_vport_intr_clean_queues, 0,
 				  name, q_vector);
 		if (err) {
 			netdev_err(vport->netdev,
 				   "Request_irq failed, error: %d\n", err);
+			kfree(name);
 			goto free_q_irqs;
 		}
Quoted 5 lines
Quoted 3 lines

base-commit: 551c722f40809618230001baccf219193e22fc5a --
2.43.0