Hi,
I am developing a kernel module that takes chunks of data, each up to 16
kbytes, from a user mode process. The module stores the data temporarily in
a char array that is defined locally in a function:
int get_data(char* puser)
{
char temp[16384];
/* copy data from user's pointer to temp */
/* Acquire spinlock */
/* process data in temp */
/* copy processed temp to card memory */
/* release spinlock */
If I use this module, the system becomes very unstable and the symtoms varyQuote:}
greatly each time. Sometimes, the system freezes, sometimes the process
becomes a zombie, sometimes certain features of the windows manager stop
working, while everything else is fine.
I though that this could be a stack problem and I tried kmalloc'ing the temp
buffer, processing the data and then kfree'ing the temp buffer:
int get_data(char* puser)
{
char* temp;
/* kmalloc 16384 bytes of memory at temp */
/* copy data from user's pointer to temp */
/* Acquire spinlock */
/* process data in temp */
/* copy processed temp to card memory */
/* release spinlock */
/* kfree allocated memory at temp */
This time, the module worked flawlessly and the system remained stable. HowQuote:}
would one method not work and the other would work? I wanted to use a local
array to avoid the overhead associated with kmalloc and kfree, but
apparently something is wrong with doing that.
Is there a limitation on how large local arrays can be in the kernel?
And by the way, the data copied is 8191 bytes, so that buffer is only half
full.
Timur.