Skip to contentSkip to conversation

i40e: fix integer overflow in i40e_dbg_command_write()

PATCH In review rivaldihormat-debug 2 participants 3 messages Sep 5 – Sep 8

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i40e: fix integer overflow in i40e_dbg_command_write()

From: Rifaldi Hormat <[email protected]>

---
 drivers/net/ethernet/intel/i40e/i40e_debugfs.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/net/ethernet/intel/i40e/i40e_debugfs.c +4 -0
index 0b52509cb14c..74e75504fdda 100644
@@ -722,6 +722,8 @@ static ssize_t i40e_dbg_command_write(struct file *filp,
 	int cnt;
 
 	/* don't allow partial writes */
+	if (count == 0 || count > PAGE_SIZE)
+		return -EINVAL;
 	if (*ppos != 0)
 		return 0;
 
@@ -1605,6 +1607,8 @@ static ssize_t i40e_dbg_netdev_ops_write(struct file *filp,
 	int i, cnt;
 
 	/* don't allow partial writes */
+	if (count == 0 || count > PAGE_SIZE)
+		return -EINVAL;
 	if (*ppos != 0)
 		return 0;
 
Signature · 1 line
2.53.0
#1 lore raw
Quoted 11 lines

-----Original Message-----
From: rivaldihormat-debug <[email protected]>
Sent: Saturday, September 5, 2026 6:32 PM
To: [email protected]
Cc: [email protected]; Rifaldi Hormat <[email protected]>
Subject: [PATCH] i40e: fix integer overflow in i40e_dbg_command_write()

Quoted 2 lines

From: Rifaldi Hormat <[email protected]>

Dear Rifaldi,

Thank you for the patch to fix the integer overflow in i40e_dbg_command_write(). The fix is sensible. However, please ensure your commit message clearly states:

- The bug: An attacker or local user could trigger a buffer overflow or integer overflow by writing large amounts of data to the debugfs file.
- The fix: Limiting the write size to PAGE_SIZE.
- Why PAGE_SIZE: It is a common limit for debugfs writes to prevent excessive stack/heap allocation.

With the best regards
Alex

Quoted 32 lines
---
 drivers/net/ethernet/intel/i40e/i40e_debugfs.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/net/ethernet/intel/i40e/i40e_debugfs.c +4 -1
index 0b52509cb14c..74e75504fdda 100644
@@ -722,6 +722,8 @@ static ssize_t i40e_dbg_command_write(struct file
 *filp,
 	int cnt;
 
 	/* don't allow partial writes */
+	if (count == 0 || count > PAGE_SIZE)
+		return -EINVAL;
 	if (*ppos != 0)
 		return 0;
@@ -1605,6 +1607,8 @@ static ssize_t i40e_dbg_netdev_ops_write(struct
 file *filp,
 	int i, cnt;
 
 	/* don't allow partial writes */
+	if (count == 0 || count > PAGE_SIZE)
+		return -EINVAL;
 	if (*ppos != 0)
 		return 0;
 
--

2.53.0

#2 lore raw

Dear Alex,

Terima kasih atas masukannya. Saya sudah memperbaiki commit message sesuai arahan Anda. Mohon maaf, patch v2 yang benar (4 baris) sudah saya kirimkan ke milis, namun karena kesalahan teknis, email tersebut terkirim terpisah dari thread ini.

Regards,
Rifaldi Hormat

Pada Sel, 8 Sep 2026, 22.36, Loktionov, Aleksandr < [email protected]> menulis:

Quoted 64 lines
Quoted 11 lines

-----Original Message-----
From: rivaldihormat-debug <[email protected]>
Sent: Saturday, September 5, 2026 6:32 PM
To: [email protected]
Cc: [email protected]; Rifaldi Hormat <[email protected]>
Subject: [PATCH] i40e: fix integer overflow in i40e_dbg_command_write()

Quoted 2 lines

From: Rifaldi Hormat <[email protected]>

Dear Rifaldi,

Thank you for the patch to fix the integer overflow in i40e_dbg_command_write().
The fix is sensible. However, please ensure your commit message clearly states:

- The bug: An attacker or local user could trigger a buffer overflow or integer overflow by writing large amounts of data to the debugfs file.
- The fix: Limiting the write size to PAGE_SIZE.
- Why PAGE_SIZE: It is a common limit for debugfs writes to prevent excessive stack/heap allocation.

With the best regards
Alex

Quoted 32 lines
---
 drivers/net/ethernet/intel/i40e/i40e_debugfs.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/net/ethernet/intel/i40e/i40e_debugfs.c +4 -1
index 0b52509cb14c..74e75504fdda 100644
@@ -722,6 +722,8 @@ static ssize_t i40e_dbg_command_write(struct file
 *filp,
      int cnt;
 
      /* don't allow partial writes */
+     if (count == 0 || count > PAGE_SIZE)
+             return -EINVAL;
      if (*ppos != 0)
              return 0;
@@ -1605,6 +1607,8 @@ static ssize_t i40e_dbg_netdev_ops_write(struct
 file *filp,
      int i, cnt;
 
      /* don't allow partial writes */
+     if (count == 0 || count > PAGE_SIZE)
+             return -EINVAL;
      if (*ppos != 0)
              return 0;
 
--

2.53.0