[09/10] net/ixgbe/base: add missing buffer copy

Message ID 20250114101024.159941-10-yuanx.wang@intel.com (mailing list archive)
State Accepted
Delegated to: Bruce Richardson
Headers
Series update net/ixgbe base driver |

Checks

Context Check Description
ci/checkpatch warning coding style issues

Commit Message

Yuan Wang Jan. 14, 2025, 10:10 a.m. UTC
From: Dan Nowlin <dan.nowlin@intel.com>

Add missing buffer copy in ixgbe_aci_send_cmd_sc().

In ixgbe_aci_send_cmd_sc() there is code to retry aq commands for
certain commands. To achieve this the function makes a copy of the
original ixgbe_aci_desc structure and allocates memory to store an
original copy of the command buffer. This allows the original structure
and buffer to be restored before attempting the command again. However,
the function didn't perform the actual copy of the original command
buffer into the copy buffer.

Signed-off-by: Dan Nowlin <dan.nowlin@intel.com>
Signed-off-by: Yuan Wang <yuanx.wang@intel.com>
---
 drivers/net/ixgbe/base/ixgbe_e610.c | 1 +
 1 file changed, 1 insertion(+)
  

Comments

Bruce Richardson Jan. 20, 2025, 3:18 p.m. UTC | #1
On Tue, Jan 14, 2025 at 06:10:19PM +0800, Yuan Wang wrote:
> From: Dan Nowlin <dan.nowlin@intel.com>
> 
> Add missing buffer copy in ixgbe_aci_send_cmd_sc().
> 
> In ixgbe_aci_send_cmd_sc() there is code to retry aq commands for
> certain commands. To achieve this the function makes a copy of the
> original ixgbe_aci_desc structure and allocates memory to store an
> original copy of the command buffer. This allows the original structure
> and buffer to be restored before attempting the command again. However,
> the function didn't perform the actual copy of the original command
> buffer into the copy buffer.
> 
> Signed-off-by: Dan Nowlin <dan.nowlin@intel.com>
> Signed-off-by: Yuan Wang <yuanx.wang@intel.com>
> ---
>  drivers/net/ixgbe/base/ixgbe_e610.c | 1 +
>  1 file changed, 1 insertion(+)
> 

Fixes: 25b48e569f2f ("net/ixgbe/base: add E610 Admin Command Interface")
Cc: stable@dpdk.org
  

Patch

diff --git a/drivers/net/ixgbe/base/ixgbe_e610.c b/drivers/net/ixgbe/base/ixgbe_e610.c
index dc4eafaa5a..5474c3012a 100644
--- a/drivers/net/ixgbe/base/ixgbe_e610.c
+++ b/drivers/net/ixgbe/base/ixgbe_e610.c
@@ -282,6 +282,7 @@  s32 ixgbe_aci_send_cmd(struct ixgbe_hw *hw, struct ixgbe_aci_desc *desc,
 			buf_cpy = (u8 *)ixgbe_malloc(hw, buf_size);
 			if (!buf_cpy)
 				return IXGBE_ERR_OUT_OF_MEM;
+			memcpy(buf_cpy, buf, buf_size);
 		}
 		memcpy(&desc_cpy, desc, sizeof(desc_cpy));
 	}