]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ixgbe: fix unaligned u32 access in ixgbe_update_flash_X550()
authorAleksandr Loktionov <aleksandr.loktionov@intel.com>
Fri, 1 May 2026 06:37:20 +0000 (23:37 -0700)
committerJakub Kicinski <kuba@kernel.org>
Sun, 3 May 2026 02:12:46 +0000 (19:12 -0700)
ixgbe_host_interface_command() treats its buffer as a u32 array. The
local buffer we pass in was a union of byte-sized fields, which gives
it 1-byte alignment on the stack. On strict-align architectures this
can cause unaligned 32-bit accesses.

Add a u32 member to union ixgbe_hic_hdr2 so the object is 4-byte
aligned, and pass the u32 member when calling
ixgbe_host_interface_command().

No functional change on x86; prevents unaligned accesses on
architectures that enforce natural alignment.

Fixes: 49425dfc7451 ("ixgbe: Add support for x550em_a 10G MAC type")
Signed-off-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Reviewed-by: Jedrzej Jagielski <jedrzej.jagielski@intel.com>
Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>
Fixes: 6a14ee0cfb19 ("ixgbe: Add X550 support function pointers")
Tested-by: Rinitha S <sx.rinitha@intel.com>
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Link: https://patch.msgid.link/20260430-jk-iwl-net-next-2026-04-30-v1-9-6f27ae1cd073@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/intel/ixgbe/ixgbe_type.h
drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c

index 01d0aa70b2b732d16f239af12ba889dde499ff5a..a461b6542f96b25009eedabffb77e7b262634947 100644 (file)
@@ -2798,6 +2798,7 @@ struct ixgbe_hic_hdr2_rsp {
 };
 
 union ixgbe_hic_hdr2 {
+       u32 buf[1];
        struct ixgbe_hic_hdr2_req req;
        struct ixgbe_hic_hdr2_rsp rsp;
 };
index 76d2fa3ef518256c28b1babda2d00ff31636752f..4a0ccbf448a2ad0cb4e9a98c165992bb5f403172 100644 (file)
@@ -1228,7 +1228,7 @@ static int ixgbe_update_flash_X550(struct ixgbe_hw *hw)
        buffer.req.buf_lenl = FW_SHADOW_RAM_DUMP_LEN;
        buffer.req.checksum = FW_DEFAULT_CHECKSUM;
 
-       status = ixgbe_host_interface_command(hw, &buffer, sizeof(buffer),
+       status = ixgbe_host_interface_command(hw, buffer.buf, sizeof(buffer),
                                              IXGBE_HI_COMMAND_TIMEOUT, false);
        return status;
 }