Re: [PATCH]media:dvb: add compat_ioctl def for dmx_dvr

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jan 18, 2021 at 7:21 AM root jason <jason.root.w@xxxxxxxxx> wrote:
> From: jason.wang <jason.root.w@xxxxxxxxx>
>
> add compat_ioctl define for dmx_dvr to handle ioctl when CONFIG_COMPAT is enable.
>
> Signed-off-by: .jason.wang <jason.root.w@xxxxxxxxx>
> ---
>  drivers/media/dvb-core/dmxdev.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/media/dvb-core/dmxdev.c b/drivers/media/dvb-core/dmxdev.c
> index f14a872d1268..4a9e027de827 100644
> --- a/drivers/media/dvb-core/dmxdev.c
> +++ b/drivers/media/dvb-core/dmxdev.c
> @@ -1393,6 +1393,7 @@ static const struct file_operations dvb_dvr_fops = {
>         .read = dvb_dvr_read,
>         .write = dvb_dvr_write,
>         .unlocked_ioctl = dvb_dvr_ioctl,
> +       .compat_ioctl = dvb_dvr_ioctl,
>         .open = dvb_dvr_open,
>         .release = dvb_dvr_release,
>         .poll = dvb_dvr_poll,

This is correct for DMX_SET_BUFFER_SIZE, which takes an integer
argument, but not strictly correct for the other ones that take a pointer
argument and need a compat_ptr() conversion.

You could do it by either passing both the 'unsigned long arg'
and the 'void __user *argp' pointer to dvb_usercopy(), with the
pointer coming from compat_ptr() in case of compat, or you
add something like

         if (in_compat_syscall())
                   arg = compat_ptr(unsigned long arg);

in the function itself. I checked the DVB ioctls to make sure that
no other ioctl commands need any special handling, and found
that DMX_SET_BUFFER_SIZE is the only one.

          Arnd



[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux