Subject: Re: [PATCH 2/4 - 2.6.15]net: 32 bit (socket layer) ioctl emulation for 64 bit kernels

From: Arnd Bergmann <[email-masked]>
Date: Thu, 12 Jan 2006 19:24:02 +0000

On Thursday 12 January 2006 06:02, Shaun Pereira wrote:
> +int compat_sock_get_timestamp(struct sock *sk, struct timeval __user
> *userstamp)
> +{
> +       struct compat_timeval __user *ctv;
> +       ctv = (struct compat_timeval __user*) userstamp;
> +       if(!sock_flag(sk, SOCK_TIMESTAMP))
> +               sock_enable_timestamp(sk);
> +       if(sk->sk_stamp.tv_sec == -1)
> +               return -ENOENT;
> +       if(sk->sk_stamp.tv_sec == 0)
> +               do_gettimeofday(&sk->sk_stamp);
> +       return copy_to_user(ctv, &sk->sk_stamp, sizeof(struct
> compat_timeval)) ?
> +                       -EFAULT : 0;
> +}

This looks wrong, you're not doing any conversion here.
You cannot just copy sk_stamp to ctv, they are not compatible.
See compat_sys_gettimeofday on how to copy a struct timeval
correctly.

The other patches look good.

	Arnd <><