Re: copy_to/from_user and a bottom half

From: Andi Kleen (ak@suse.de)
Date: Thu May 18 2000 - 13:45:02 EST


Alex Ivchenko <aivchenko@ueidaq.com> writes:

> Hi,
>
> I tried to speed up a driver and moved copy_to_user()
> from ioctl to the bottom half of interrupt handler.
>
> access_ok() returns TRUE (of course, user address is valid), but
> copy_to_user() couldn't copy anything into the user space.
>
> bh is sched like:
> queue_task(&pd_bh_task, &tq_immediate);
> mark_bh(IMMEDIATE_BH);
>
> and spin_lock_irqsave() is NOT used in bh as well as any other
> sync stuff.
>
> I assumed that if lock is not set kernel could use exception handlers
> (according to Documentation/exception.txt) to get user space mem page.
>
> Could you tell me what is wrong?

You cannot do that. copy_*_user requires a process context, and
a bottom half does not have one (or at least not the one you want)

-Andi

-
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 : Tue May 23 2000 - 21:00:15 EST