Re: [PROBLEM] sleeping function called from invalid context at mm/slab.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sunday 10 June 2007 13:03, Lukas Razik wrote:
> Hello!
>
> I'm new to kernel programming and I try to develop a fake ethernet driver
> for v2.6.21.3 which I really need based on netdev but I ran into the
> following issue:
> If the kernel calls the 'dev->hard_start_xmit' function of my driver then
> this calls another one which try to create a socket in the following
> "normal way":
>
> struct socket *ssock = NULL;
> ...
> sock_create(family, SOCK_STREAM, IPPROTO_TCP, &ssock);
>
> But at this point I get an error message from the kernel as appended below.
> So what have I done wrong?
>

Hi Lukas,

The hard_start_xmit function is running in interrupt context, thus you can't 
call any functions that might sleep (and sock_create is one of them because 
it probably allocates memory with GFP_KERNEL)

I'm not sure what is the purpose of you ethernet driver, but when you run into 
this types of problems, you need to deffer the work that might sleep and run 
it from process context. workqueues and kernel threads are the means for 
that.


tavi

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux