summaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c
diff options
context:
space:
mode:
authorMark Rustad2016-03-14 19:05:51 +0100
committerJeff Kirsher2016-04-08 00:30:16 +0200
commit73457165d71d5ce0e41c0adb7bfa484702c36248 (patch)
tree8ba0d1332c62ad23dd21d6ba150107d3e7f90031 /drivers/net/ethernet/intel/ixgbe/ixgbe_common.c
parentixgbe: Change the lan_id and func fields to a u8 to avoid casts (diff)
downloadkernel-qcow2-linux-73457165d71d5ce0e41c0adb7bfa484702c36248.tar.gz
kernel-qcow2-linux-73457165d71d5ce0e41c0adb7bfa484702c36248.tar.xz
kernel-qcow2-linux-73457165d71d5ce0e41c0adb7bfa484702c36248.zip
ixgbe: Correct length check for round up
The function ixgbe_host_interface_command actually uses a multiple of word sized buffer to do its business, but only checks against the actual length passed in. This means that on read operations it could be possible to modify locations beyond the length passed in. Change the check to round up in the same way, just to avoid any possible hazard. Signed-off-by: Mark Rustad <mark.d.rustad@intel.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net/ethernet/intel/ixgbe/ixgbe_common.c')
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_common.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c
index dfdb1149b6fd..a2ca9ef0daab 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c
@@ -3557,7 +3557,7 @@ s32 ixgbe_host_interface_command(struct ixgbe_hw *hw, u32 *buffer,
if (buf_len == 0)
return 0;
- if (length < (buf_len + hdr_size)) {
+ if (length < round_up(buf_len, 4) + hdr_size) {
hw_dbg(hw, "Buffer not large enough for reply message.\n");
return IXGBE_ERR_HOST_INTERFACE_COMMAND;
}