summaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorAlice Michael <alice.michael@intel.com>2018-10-26 14:33:31 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-12-13 08:51:18 +0100
commitd5be9df0679440bdca7412e2c303aca1f561696a (patch)
tree29de7e41f56da3f91141ccd02be5aae5a83a0d5b /include/linux
parentea962fa132b6633479835b83aeb7944c958ccb8d (diff)
downloadlinux-stable-d5be9df0679440bdca7412e2c303aca1f561696a.tar.gz
linux-stable-d5be9df0679440bdca7412e2c303aca1f561696a.tar.bz2
linux-stable-d5be9df0679440bdca7412e2c303aca1f561696a.zip
virtchnl: Fix off by one error
[ Upstream commit 843faff87af261bf55eda719a06087af0486a168 ] When calculating the valid length for a VIRTCHNL_OP_ENABLE_CHANNELS message, we accidentally allowed messages with one extra virtchnl_channel_info structure on the end. This happened due to an off by one error, because we forgot that valid_len already accounted for one virtchnl_channel_info structure, so we need to subtract one from the num_tc value. Signed-off-by: Alice Michael <alice.michael@intel.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/avf/virtchnl.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/include/linux/avf/virtchnl.h b/include/linux/avf/virtchnl.h
index 212b3822d180..92d179fb6d59 100644
--- a/include/linux/avf/virtchnl.h
+++ b/include/linux/avf/virtchnl.h
@@ -798,8 +798,8 @@ virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode,
if (msglen >= valid_len) {
struct virtchnl_tc_info *vti =
(struct virtchnl_tc_info *)msg;
- valid_len += vti->num_tc *
- sizeof(struct virtchnl_channel_info);
+ valid_len += (vti->num_tc - 1) *
+ sizeof(struct virtchnl_channel_info);
if (vti->num_tc == 0)
err_msg_format = true;
}