Sleeping in illegal context with 2.5.65-mm2
Caught this one while booting my laptop:
drivers/usb/core/usb.c: registered new driver hci_usb
Module bluetooth cannot be unloaded due to unsafe usage in include/linux/module.h:457
Debug: sleeping function called from illegal context at mm/slab.c:1723
Call Trace: [<c0119d92>] __might_sleep+0x5f/0x65 [<c013a097>] kmalloc+0x88/0x8f [<c0238111>] usb_alloc_urb+0x21/0x51 [<f09180bc>] hci_usb_enable_intr+0x20/0xf8 [hci_usb] [<f0918403>] hci_usb_open+0x4e/0x9a [hci_usb] [<f08f86a2>] hci_dev_open+0xde/0x320 [bluetooth] [<f08fd3cb>] hci_sock_ioctl+0x263/0x3c1 [bluetooth] [<c0254d8f>] sock_ioctl+0xf5/0x288 [<c015e3a6>] sys_ioctl+0x11b/0x295 [<c010ad8b>] syscall_call+0x7/0xb
.config is attached
mvh,
A
Signature · 4 lines
-- Alexander Hoogerhuis | [email protected] CCNP - CCDP - MCNE - CCSE | +47 908 21 485 "You have zero privacy anyway. Get over it." --Scott McNealy
Quoted 10 lines · Alexander Hoogerhuis
Caught this one while booting my laptop:
drivers/usb/core/usb.c: registered new driverhci_usb
Module bluetooth cannot be unloaded due to unsafe usage ininclude/linux/module.h:457
Debug: sleeping function called from illegal context atmm/slab.c:1723Call Trace: [<c0119d92>] __might_sleep+0x5f/0x65 [<c013a097>] kmalloc+0x88/0x8f [<c0238111>] usb_alloc_urb+0x21/0x51 [<f09180bc>] hci_usb_enable_intr+0x20/0xf8 [hci_usb]
The call to usb_alloc_urb() here is being done with the GFP_ATOMIC flag, which is correct. Do we need to fix up the warning message to prevent false positives like this from happening?
thanks,
greg k-h
Quoted 10 lines · Greg KH
Quoted 6 lines
Debug: sleeping function called from illegal context at
mm/slab.c:1723Call Trace: [<c0119d92>] __might_sleep+0x5f/0x65 [<c013a097>] kmalloc+0x88/0x8f [<c0238111>] usb_alloc_urb+0x21/0x51 [<f09180bc>] hci_usb_enable_intr+0x20/0xf8 [hci_usb]The call to
usb_alloc_urb()here is being done with theGFP_ATOMICflag, which is correct. Do we need to fix up the warning message to prevent false positives like this from happening?
Not in my tree: (drivers/bluetooth/hci_sb.c)
if (!(urb = usb_alloc_urb(0, GFP_KERNEL)))
return -ENOMEM;
And the function is called in a write_lock_irqsave(), so the complaint is justified. (Also, I think __might_sleep() deliberately doesn't get triggered for GFP_ATOMIC already, as you suggested).
--Kai
Quoted 9 lines · Kai Germaschewski
Quoted 7 lines · Greg KH
Quoted 6 lines
Debug: sleeping function called from illegal context at
mm/slab.c:1723Call Trace: [<c0119d92>] __might_sleep+0x5f/0x65 [<c013a097>] kmalloc+0x88/0x8f [<c0238111>] usb_alloc_urb+0x21/0x51 [<f09180bc>] hci_usb_enable_intr+0x20/0xf8 [hci_usb]
Quoted 8 lines
Quoted 3 lines
The call to
usb_alloc_urb()here is being done with theGFP_ATOMICflag, which is correct. Do we need to fix up the warning message to prevent false positives like this from happening?Not in my tree: (
drivers/bluetooth/hci_sb.c)if (!(urb =
usb_alloc_urb(0, GFP_KERNEL)))return -ENOMEM;
Doh, nevermind, I was looking at the wrong function, sorry.
Quoted 2 lines
And the function is called in a
write_lock_irqsave(), so the complaint is justified.
Max, you should probably fix this up.
Quoted 2 lines
(Also, I think
__might_sleep()deliberately doesn't get triggered forGFP_ATOMICalready, as you suggested).
Yeah, in digging deeper, it's a smart check, sorry.
thanks,
greg k-h
Quoted 19 lines · Greg KH
Quoted 9 lines · Kai Germaschewski
Quoted 7 lines · Greg KH
Quoted 6 lines
Debug: sleeping function called from illegal context at
mm/slab.c:1723Call Trace: [<c0119d92>] __might_sleep+0x5f/0x65 [<c013a097>] kmalloc+0x88/0x8f [<c0238111>] usb_alloc_urb+0x21/0x51 [<f09180bc>] hci_usb_enable_intr+0x20/0xf8 [hci_usb]Quoted 8 lines
Quoted 3 lines
The call to
usb_alloc_urb()here is being done with theGFP_ATOMICflag, which is correct. Do we need to fix up the warning message to prevent false positives like this from happening?Not in my tree: (
drivers/bluetooth/hci_sb.c)if (!(urb = usb_alloc_urb(0, GFP_KERNEL))) return -ENOMEM;
Quoted 6 lines
Doh, nevermind, I was looking at the wrong function, sorry.
Quoted 2 lines
And the function is called in a
write_lock_irqsave(), so the complaint is justified.Max, you should probably fix this up.
Will do.
Thanks
Max