Skip to content
Commit 3ed21c14 authored by Dan Carpenter's avatar Dan Carpenter Committed by Michael S. Tsirkin
Browse files

vdpa: check that offsets are within bounds

In this function "c->off" is a u32 and "size" is a long.  On 64bit systems
if "c->off" is greater than "size" then "size - c->off" is a negative and
we always return -E2BIG.  But on 32bit systems the subtraction is type
promoted to a high positive u32 value and basically any "c->len" is
accepted.

Fixes: 4c8cf318

 ("vhost: introduce vDPA-based backend")
Reported-by: default avatarXie Yongji <xieyongji@bytedance.com>
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/20211208103337.GA4047@kili


Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
Cc: stable@vger.kernel.org
parent ff9f9c6e
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment