• Daniel Mentz's avatar
    media: v4l2-compat-ioctl32: Fix timespec conversion · 9c7ba1d7
    Daniel Mentz authored
    Certain syscalls like recvmmsg support 64 bit timespec values for the
    X32 ABI. The helper function compat_put_timespec converts a timespec
    value to a 32 bit or 64 bit value depending on what ABI is used. The
    v4l2 compat layer, however, is not designed to support 64 bit timespec
    values and always uses 32 bit values. Hence, compat_put_timespec must
    not be used.
    
    Without this patch, user space will be provided with bad timestamp
    values from the VIDIOC_DQEVENT ioctl. Also, fields of the struct
    v4l2_event32 that come immediately after timestamp get overwritten,
    namely the field named id.
    
    Fixes: 81993e81 ("compat: Get rid of (get|put)_compat_time(val|spec)")
    
    Cc: stable@vger.kernel.org
    Cc: H. Peter Anvin <hpa@linux.intel.com>
    Cc: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
    Cc: Tiffany Lin <tiffany.lin@mediatek.com>
    Cc: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
    Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
    Signed-off-by: default avatarDaniel Mentz <danielmentz@google.com>
    Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
    Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
    9c7ba1d7
v4l2-compat-ioctl32.c 30 KB