Re: [RFC PATCH 7/7] sound: core: Avoid using timespec for struct snd_timer_tread

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

 



On Thu, Sep 21, 2017 at 8:18 AM, Baolin Wang <baolin.wang@xxxxxxxxxx> wrote:

> +static int snd_timer_user_tread(void __user *argp, struct snd_timer_user *tu,
> +                               unsigned int cmd)
> +{
> +       int __user *p = argp;
> +       int xarg, old_tread;
> +
> +       if (tu->timeri) /* too late */
> +               return -EBUSY;
> +       if (get_user(xarg, p))
> +               return -EFAULT;
> +
> +       old_tread = tu->tread;
> +#if __BITS_PER_LONG == 64
> +       tu->tread = xarg ? 2 : 0;
> +#ifdef IA32_EMULATION
> +       tu->tread = xarg ? 3 : 0;
> +#endif
> +#else
> +       if (cmd == SNDRV_TIMER_IOCTL_TREAD64)
> +               tu->tread = xarg ? 2 : 0;
> +       else
> +               tu->tread = xarg ? 1 : 0;
> +#endif

The 64-bit case looks broken here:

- The tread flag is different for compat and native mode, so you
   must pass a flag to identify whether you are called from
   __snd_timer_user_ioctl or from snd_timer_user_ioctl_compat().

- On x86, you have to check whether calling user space process uses
   the i386 or the x32 ABI by checking in_x32_syscall()

       Arnd
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux