* [PATCH] Bluetooth: Use GFP_KERNEL in read_index_list
@ 2012-08-31 7:05 Szymon Janc
2012-08-31 16:11 ` Marcel Holtmann
2012-08-31 17:54 ` Gustavo Padovan
0 siblings, 2 replies; 6+ messages in thread
From: Szymon Janc @ 2012-08-31 7:05 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Szymon Janc
read_index_list is executed by user thread running in kernel-mode
thus is allowed to sleep.
Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
---
net/bluetooth/mgmt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index a3329cb..7b1a5c8 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -340,7 +340,7 @@ static int read_index_list(struct sock *sk, struct hci_dev *hdev, void *data,
}
rp_len = sizeof(*rp) + (2 * count);
- rp = kmalloc(rp_len, GFP_ATOMIC);
+ rp = kmalloc(rp_len, GFP_KERNEL);
if (!rp) {
read_unlock(&hci_dev_list_lock);
return -ENOMEM;
--
1.7.9.5
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] Bluetooth: Use GFP_KERNEL in read_index_list
2012-08-31 7:05 [PATCH] Bluetooth: Use GFP_KERNEL in read_index_list Szymon Janc
@ 2012-08-31 16:11 ` Marcel Holtmann
2012-08-31 17:54 ` Gustavo Padovan
1 sibling, 0 replies; 6+ messages in thread
From: Marcel Holtmann @ 2012-08-31 16:11 UTC (permalink / raw)
To: Szymon Janc; +Cc: linux-bluetooth
Hi Szymon,
> read_index_list is executed by user thread running in kernel-mode
> thus is allowed to sleep.
>
> Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
> ---
> net/bluetooth/mgmt.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Regards
Marcel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Bluetooth: Use GFP_KERNEL in read_index_list
2012-08-31 7:05 [PATCH] Bluetooth: Use GFP_KERNEL in read_index_list Szymon Janc
2012-08-31 16:11 ` Marcel Holtmann
@ 2012-08-31 17:54 ` Gustavo Padovan
2012-09-03 12:34 ` Andrei Emeltchenko
1 sibling, 1 reply; 6+ messages in thread
From: Gustavo Padovan @ 2012-08-31 17:54 UTC (permalink / raw)
To: Szymon Janc; +Cc: linux-bluetooth
Hi Szymon,
* Szymon Janc <szymon.janc@tieto.com> [2012-08-31 09:05:46 +0200]:
> read_index_list is executed by user thread running in kernel-mode
> thus is allowed to sleep.
>
> Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
> ---
> net/bluetooth/mgmt.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Patch has been applied to bluetooth-next. Thanks.
Gustavo
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Bluetooth: Use GFP_KERNEL in read_index_list
2012-08-31 17:54 ` Gustavo Padovan
@ 2012-09-03 12:34 ` Andrei Emeltchenko
2012-09-03 12:49 ` Szymon Janc
0 siblings, 1 reply; 6+ messages in thread
From: Andrei Emeltchenko @ 2012-09-03 12:34 UTC (permalink / raw)
To: Gustavo Padovan, Szymon Janc, linux-bluetooth
Hi all,
On Fri, Aug 31, 2012 at 10:54:58AM -0700, Gustavo Padovan wrote:
> Hi Szymon,
>
> * Szymon Janc <szymon.janc@tieto.com> [2012-08-31 09:05:46 +0200]:
>
> > read_index_list is executed by user thread running in kernel-mode
> > thus is allowed to sleep.
> >
> > Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
> > ---
> > net/bluetooth/mgmt.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
>
> Patch has been applied to bluetooth-next. Thanks.
Was this tested? Gustavo please remove this patch from the tree untill
this issue is fixed.
[ 141.009142] BUG: sleeping function called from invalid context at
mm/slub.c:943
[ 141.009156] in_atomic(): 1, irqs_disabled(): 0, pid: 2476, name:
bluetoothd
[ 141.009159] 2 locks held by bluetoothd/2476:
[ 141.009161] #0: (sk_lock-AF_BLUETOOTH-BTPROTO_HCI){+.+.+.}, at:
[<f8a9c9da>] hci_sock_sendmsg+0x5a/0x310 [bluetooth]
[ 141.009182] #1: (hci_dev_list_lock){++++.+}, at: [<f8a9623e>]
read_index_list+0x2e/0x150 [bluetooth]
[ 141.009200] Pid: 2476, comm: bluetoothd Tainted: G O 3.5.0+
#56
[ 141.009202] Call Trace:
[ 141.009208] [<c10776c9>] __might_sleep+0xe9/0x120
[ 141.009213] [<c114e249>] __kmalloc+0x1a9/0x240
[ 141.009224] [<f8a96274>] ? read_index_list+0x64/0x150 [bluetooth]
[ 141.009234] [<f8a96274>] read_index_list+0x64/0x150 [bluetooth]
[ 141.009244] [<f8a9a2bc>] mgmt_control+0x22c/0x350 [bluetooth]
[ 141.009248] [<c10a44fb>] ? trace_hardirqs_on+0xb/0x10
[ 141.009252] [<c1051298>] ? local_bh_enable+0x68/0xd0
[ 141.009264] [<f8a9c9da>] ? hci_sock_sendmsg+0x5a/0x310 [bluetooth]
[ 141.009297] [<f8a9ca43>] hci_sock_sendmsg+0xc3/0x310 [bluetooth]
[ 141.009302] [<c14f134d>] ? sock_update_classid+0x7d/0x120
[ 141.009306] [<c14f1378>] ? sock_update_classid+0xa8/0x120
[ 141.009311] [<c14ecc6b>] sock_aio_write+0xfb/0x120
[ 141.009315] [<c14ee31e>] ? sys_sendto+0x10e/0x150
[ 141.009320] [<c115fbf4>] do_sync_write+0xb4/0xf0
[ 141.009326] [<c112f680>] ? might_fault+0x50/0xa0
[ 141.009330] [<c11602cc>] ? rw_verify_area+0x6c/0x120
[ 141.009334] [<c11606f1>] vfs_write+0x151/0x160
[ 141.009337] [<c14eed02>] ? sys_socketcall+0x182/0x2e0
[ 141.009341] [<c116090d>] sys_write+0x3d/0x70
[ 141.009345] [<c15f739f>] sysenter_do_call+0x12/0x38
Best regards
Andrei Emeltchenko
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Bluetooth: Use GFP_KERNEL in read_index_list
2012-09-03 12:34 ` Andrei Emeltchenko
@ 2012-09-03 12:49 ` Szymon Janc
2012-09-03 13:07 ` Szymon Janc
0 siblings, 1 reply; 6+ messages in thread
From: Szymon Janc @ 2012-09-03 12:49 UTC (permalink / raw)
To: Andrei Emeltchenko; +Cc: Gustavo Padovan, linux-bluetooth
On Monday 03 of September 2012 15:34:11 Andrei Emeltchenko wrote:
> Hi all,
Hi Andrei,
>
> On Fri, Aug 31, 2012 at 10:54:58AM -0700, Gustavo Padovan wrote:
> > Hi Szymon,
> >
> > * Szymon Janc <szymon.janc@tieto.com> [2012-08-31 09:05:46 +0200]:
> >
> > > read_index_list is executed by user thread running in kernel-mode
> > > thus is allowed to sleep.
> > >
> > > Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
> > > ---
> > > net/bluetooth/mgmt.c | 2 +-
> > > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > Patch has been applied to bluetooth-next. Thanks.
>
> Was this tested? Gustavo please remove this patch from the tree untill
> this issue is fixed.
read_index_list() is only called from mgmt_control() (via mgmt_handlers[]).
mgmt_control (as well as other mgmt_handlers) allocate memory with
GFP_KERNEL flag.
I'm not sure why do you get this warning...
>
> [ 141.009142] BUG: sleeping function called from invalid context at
> mm/slub.c:943
> [ 141.009156] in_atomic(): 1, irqs_disabled(): 0, pid: 2476, name:
> bluetoothd
> [ 141.009159] 2 locks held by bluetoothd/2476:
> [ 141.009161] #0: (sk_lock-AF_BLUETOOTH-BTPROTO_HCI){+.+.+.}, at:
> [<f8a9c9da>] hci_sock_sendmsg+0x5a/0x310 [bluetooth]
> [ 141.009182] #1: (hci_dev_list_lock){++++.+}, at: [<f8a9623e>]
> read_index_list+0x2e/0x150 [bluetooth]
> [ 141.009200] Pid: 2476, comm: bluetoothd Tainted: G O 3.5.0+
> #56
> [ 141.009202] Call Trace:
> [ 141.009208] [<c10776c9>] __might_sleep+0xe9/0x120
> [ 141.009213] [<c114e249>] __kmalloc+0x1a9/0x240
> [ 141.009224] [<f8a96274>] ? read_index_list+0x64/0x150 [bluetooth]
> [ 141.009234] [<f8a96274>] read_index_list+0x64/0x150 [bluetooth]
> [ 141.009244] [<f8a9a2bc>] mgmt_control+0x22c/0x350 [bluetooth]
> [ 141.009248] [<c10a44fb>] ? trace_hardirqs_on+0xb/0x10
> [ 141.009252] [<c1051298>] ? local_bh_enable+0x68/0xd0
> [ 141.009264] [<f8a9c9da>] ? hci_sock_sendmsg+0x5a/0x310 [bluetooth]
> [ 141.009297] [<f8a9ca43>] hci_sock_sendmsg+0xc3/0x310 [bluetooth]
> [ 141.009302] [<c14f134d>] ? sock_update_classid+0x7d/0x120
> [ 141.009306] [<c14f1378>] ? sock_update_classid+0xa8/0x120
> [ 141.009311] [<c14ecc6b>] sock_aio_write+0xfb/0x120
> [ 141.009315] [<c14ee31e>] ? sys_sendto+0x10e/0x150
> [ 141.009320] [<c115fbf4>] do_sync_write+0xb4/0xf0
> [ 141.009326] [<c112f680>] ? might_fault+0x50/0xa0
> [ 141.009330] [<c11602cc>] ? rw_verify_area+0x6c/0x120
> [ 141.009334] [<c11606f1>] vfs_write+0x151/0x160
> [ 141.009337] [<c14eed02>] ? sys_socketcall+0x182/0x2e0
> [ 141.009341] [<c116090d>] sys_write+0x3d/0x70
> [ 141.009345] [<c15f739f>] sysenter_do_call+0x12/0x38
>
> Best regards
> Andrei Emeltchenko
--
BR
Szymon Janc
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Bluetooth: Use GFP_KERNEL in read_index_list
2012-09-03 12:49 ` Szymon Janc
@ 2012-09-03 13:07 ` Szymon Janc
0 siblings, 0 replies; 6+ messages in thread
From: Szymon Janc @ 2012-09-03 13:07 UTC (permalink / raw)
To: Andrei Emeltchenko; +Cc: Gustavo Padovan, linux-bluetooth
On Monday 03 of September 2012 14:49:59 Szymon Janc wrote:
> On Monday 03 of September 2012 15:34:11 Andrei Emeltchenko wrote:
> > Hi all,
>
> Hi Andrei,
>
> >
> > On Fri, Aug 31, 2012 at 10:54:58AM -0700, Gustavo Padovan wrote:
> > > Hi Szymon,
> > >
> > > * Szymon Janc <szymon.janc@tieto.com> [2012-08-31 09:05:46 +0200]:
> > >
> > > > read_index_list is executed by user thread running in kernel-mode
> > > > thus is allowed to sleep.
> > > >
> > > > Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
> > > > ---
> > > > net/bluetooth/mgmt.c | 2 +-
> > > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > Patch has been applied to bluetooth-next. Thanks.
> >
> > Was this tested? Gustavo please remove this patch from the tree untill
> > this issue is fixed.
>
> read_index_list() is only called from mgmt_control() (via mgmt_handlers[]).
> mgmt_control (as well as other mgmt_handlers) allocate memory with
> GFP_KERNEL flag.
>
> I'm not sure why do you get this warning...
Ahhh, rwlock is held while doing memory allocation..
Yes, this should be reverted.
--
Szymon Janc
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-09-03 13:07 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-31 7:05 [PATCH] Bluetooth: Use GFP_KERNEL in read_index_list Szymon Janc
2012-08-31 16:11 ` Marcel Holtmann
2012-08-31 17:54 ` Gustavo Padovan
2012-09-03 12:34 ` Andrei Emeltchenko
2012-09-03 12:49 ` Szymon Janc
2012-09-03 13:07 ` Szymon Janc
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.