4) The most likely cause is that your length is bogus; I notice that
your buffer "data" (which should not be a stack buffer, it should be
allocated!) is 2K in size, but you don't do anything to ensure that
your count "bytes" is > 0 and less than 2K, so you could easily be
overflowing the buffer. Another possibility is that, since 2K is a
heck of a lot of data in kernel terms (1/8th of your entire available
stack!!!), you could be trashing the kernel stack, resulting in the
panic (this is less likely than simply having a bogus length and
smashing your own stack, but it's a possibility).
Is this a restriction that we can't send the data more
than 2k from user space to kernel space ? . If we need to send more
data from user space to general kext , pls suggest ways to do it.
5) Finally, if you are using a worker thread to do the work instead
of doing it in the context of the process making the call (you should
know whether or not you are using one - in fact, you should have told
us this when you asked the question...), then it's trying to copy in
from kernel_process, which is the wrong process to copy in from.
Basically, all copies in or out MUST occur in the context of the
process requesting the copy.
I've a user space daemon process which gets created from
the main program using pthreads. From User space daemon process i'm
calling the ioctl to kernel extension. Do you mean this way of doing
it is not the proper way ?