简体   繁体   中英

BUG: sleeping function called from invalid context at mm/slub.c:1719

I have allocated a pointer like

int *ptr = kmalloc(sizeof(int), GFP_ATOMIC); 

And this pointer is deallocated in a timer function which having 5 second timeout value.

if( NULL != ptr )                
{                 
  kfree(ptr);
  ptr = NULL;
}

Please advise me what is wrong here.. Thanking in advance.

kfree() must not be used in an atomic context, such as a timer function.

Move it to another context, such as a workqueue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM