Re: copy_to_user a big memory block

From: Daniel Olsson (daniel@olsson.tm)
Date: Tue Jun 20 2000 - 12:34:09 EST


As far as I know I don't have any lock around copy_to_user().

The user makes an IOCTL call to the module. The module tries to copy the
IP account table to the user but fails and returns -EINVAL to the
client.

I have cleaned the code and put it at http://olsson.tm/ipaccount/.
ipacc.c - The module
ipaccount.c - The client

Thanks,
Daniel

"Richard B. Johnson" wrote:
>
> On Tue, 20 Jun 2000, Daniel Olsson wrote:
> [SNIPPED...]
> >
> > My problem is that I try to send the accounting table to a user program
> > by an IOCTL call but copy_to_user fails. I have found that copy_to_user
> > fails if the size is > 2976 bytes. I allocate the memory with malloc in
> > the user process and the printf("%p",ptr)/printk("%p",ptr) pair shows
> > that the pointer to the user space memory is correct in the module. Am I
> > doing something wrong?
> >
> > Kind regards,
> > Daniel
> >
>
> Are you trying to copy_to_user() under any kind of a lock? Make sure
> the user can page-fault, remove any locks before the copy_to_user().
>
> I routinely copy 1 - 2 megabyte images to user-space with no problem.
>
> Cheers,
> Dick Johnson
>

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Fri Jun 23 2000 - 21:00:20 EST