diff options
author | Joshua Hay <joshua.a.hay@intel.com> | 2024-09-03 11:49:56 -0700 |
---|---|---|
committer | Tony Nguyen <anthony.l.nguyen@intel.com> | 2024-09-30 14:23:32 -0700 |
commit | 640f70063e6d3a76a63f57e130fba43ba8c7e980 (patch) | |
tree | e2d25d364d28fafd6cdfdf7a96fdce4342640064 /drivers/media/v4l2-core/v4l2-i2c.c | |
parent | d382c7bc236d4fc7b087ddad2732c84d222a4dc9 (diff) | |
download | lwn-640f70063e6d3a76a63f57e130fba43ba8c7e980.tar.gz lwn-640f70063e6d3a76a63f57e130fba43ba8c7e980.zip |
idpf: use actual mbx receive payload length
When a mailbox message is received, the driver is checking for a non 0
datalen in the controlq descriptor. If it is valid, the payload is
attached to the ctlq message to give to the upper layer. However, the
payload response size given to the upper layer was taken from the buffer
metadata which is _always_ the max buffer size. This meant the API was
returning 4K as the payload size for all messages. This went unnoticed
since the virtchnl exchange response logic was checking for a response
size less than 0 (error), not less than exact size, or not greater than
or equal to the max mailbox buffer size (4K). All of these checks will
pass in the success case since the size provided is always 4K. However,
this breaks anyone that wants to validate the exact response size.
Fetch the actual payload length from the value provided in the
descriptor data_len field (instead of the buffer metadata).
Unfortunately, this means we lose some extra error parsing for variable
sized virtchnl responses such as create vport and get ptypes. However,
the original checks weren't really helping anyways since the size was
_always_ 4K.
Fixes: 34c21fa894a1 ("idpf: implement virtchnl transaction manager")
Cc: stable@vger.kernel.org # 6.9+
Signed-off-by: Joshua Hay <joshua.a.hay@intel.com>
Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Tested-by: Krishneil Singh <krishneil.k.singh@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Diffstat (limited to 'drivers/media/v4l2-core/v4l2-i2c.c')
0 files changed, 0 insertions, 0 deletions