All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] Bluetooth: Use GFP_KERNEL in mgmt_handlers
@ 2012-06-07 22:05 Andre Guedes
  2012-06-07 22:05 ` [PATCH 2/3] Bluetooth: Use GFP_KERNEL in mgmt_pending_add Andre Guedes
  2012-06-07 22:05 ` [PATCH 3/3] Bluetooth: Use GFP_KERNEL in mgmt events functions Andre Guedes
  0 siblings, 2 replies; 4+ messages in thread
From: Andre Guedes @ 2012-06-07 22:05 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: andre.guedes

add_uuid and get_connections mgmt_handlers are executed by user
threads running in kernel-mode.

Signed-off-by: Andre Guedes <aguedespe@gmail.com>
---
 net/bluetooth/mgmt.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 958f764..8c7a6f9 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -1268,7 +1268,7 @@ static int add_uuid(struct sock *sk, struct hci_dev *hdev, void *data, u16 len)
 		goto failed;
 	}
 
-	uuid = kmalloc(sizeof(*uuid), GFP_ATOMIC);
+	uuid = kmalloc(sizeof(*uuid), GFP_KERNEL);
 	if (!uuid) {
 		err = -ENOMEM;
 		goto failed;
@@ -1667,7 +1667,7 @@ static int get_connections(struct sock *sk, struct hci_dev *hdev, void *data,
 	}
 
 	rp_len = sizeof(*rp) + (i * sizeof(struct mgmt_addr_info));
-	rp = kmalloc(rp_len, GFP_ATOMIC);
+	rp = kmalloc(rp_len, GFP_KERNEL);
 	if (!rp) {
 		err = -ENOMEM;
 		goto unlock;
-- 
1.7.10.3


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/3] Bluetooth: Use GFP_KERNEL in mgmt_pending_add
  2012-06-07 22:05 [PATCH 1/3] Bluetooth: Use GFP_KERNEL in mgmt_handlers Andre Guedes
@ 2012-06-07 22:05 ` Andre Guedes
  2012-06-07 22:05 ` [PATCH 3/3] Bluetooth: Use GFP_KERNEL in mgmt events functions Andre Guedes
  1 sibling, 0 replies; 4+ messages in thread
From: Andre Guedes @ 2012-06-07 22:05 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: andre.guedes

We are allowed to sleep in mgmt_pending_add, so we should use
GFP_KERNEL for memory allocations instead of GFP_ATOMIC.

Signed-off-by: Andre Guedes <aguedespe@gmail.com>
---
 net/bluetooth/mgmt.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 8c7a6f9..9a56b64 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -687,14 +687,14 @@ static struct pending_cmd *mgmt_pending_add(struct sock *sk, u16 opcode,
 {
 	struct pending_cmd *cmd;
 
-	cmd = kmalloc(sizeof(*cmd), GFP_ATOMIC);
+	cmd = kmalloc(sizeof(*cmd), GFP_KERNEL);
 	if (!cmd)
 		return NULL;
 
 	cmd->opcode = opcode;
 	cmd->index = hdev->id;
 
-	cmd->param = kmalloc(len, GFP_ATOMIC);
+	cmd->param = kmalloc(len, GFP_KERNEL);
 	if (!cmd->param) {
 		kfree(cmd);
 		return NULL;
-- 
1.7.10.3


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 3/3] Bluetooth: Use GFP_KERNEL in mgmt events functions
  2012-06-07 22:05 [PATCH 1/3] Bluetooth: Use GFP_KERNEL in mgmt_handlers Andre Guedes
  2012-06-07 22:05 ` [PATCH 2/3] Bluetooth: Use GFP_KERNEL in mgmt_pending_add Andre Guedes
@ 2012-06-07 22:05 ` Andre Guedes
  2012-06-19  3:55   ` Gustavo Padovan
  1 sibling, 1 reply; 4+ messages in thread
From: Andre Guedes @ 2012-06-07 22:05 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: andre.guedes

cmd_status, cmd_complete and mgmt_event functions are executed in
process context and they are not called inside atomic sections. Thus,
they should use GFP_KERNEL for memory allocation instead of GFP_ATOMIC.

Signed-off-by: Andre Guedes <aguedespe@gmail.com>
---
 net/bluetooth/mgmt.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 9a56b64..2575389 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -210,7 +210,7 @@ static int cmd_status(struct sock *sk, u16 index, u16 cmd, u8 status)
 
 	BT_DBG("sock %p, index %u, cmd %u, status %u", sk, index, cmd, status);
 
-	skb = alloc_skb(sizeof(*hdr) + sizeof(*ev), GFP_ATOMIC);
+	skb = alloc_skb(sizeof(*hdr) + sizeof(*ev), GFP_KERNEL);
 	if (!skb)
 		return -ENOMEM;
 
@@ -241,7 +241,7 @@ static int cmd_complete(struct sock *sk, u16 index, u16 cmd, u8 status,
 
 	BT_DBG("sock %p", sk);
 
-	skb = alloc_skb(sizeof(*hdr) + sizeof(*ev) + rp_len, GFP_ATOMIC);
+	skb = alloc_skb(sizeof(*hdr) + sizeof(*ev) + rp_len, GFP_KERNEL);
 	if (!skb)
 		return -ENOMEM;
 
@@ -812,7 +812,7 @@ static int mgmt_event(u16 event, struct hci_dev *hdev, void *data, u16 data_len,
 	struct sk_buff *skb;
 	struct mgmt_hdr *hdr;
 
-	skb = alloc_skb(sizeof(*hdr) + data_len, GFP_ATOMIC);
+	skb = alloc_skb(sizeof(*hdr) + data_len, GFP_KERNEL);
 	if (!skb)
 		return -ENOMEM;
 
-- 
1.7.10.3


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 3/3] Bluetooth: Use GFP_KERNEL in mgmt events functions
  2012-06-07 22:05 ` [PATCH 3/3] Bluetooth: Use GFP_KERNEL in mgmt events functions Andre Guedes
@ 2012-06-19  3:55   ` Gustavo Padovan
  0 siblings, 0 replies; 4+ messages in thread
From: Gustavo Padovan @ 2012-06-19  3:55 UTC (permalink / raw)
  To: Andre Guedes; +Cc: linux-bluetooth, andre.guedes

[-- Attachment #1: Type: text/plain, Size: 528 bytes --]

Hi Andre,

* Andre Guedes <aguedespe@gmail.com> [2012-06-07 19:05:46 -0300]:

> cmd_status, cmd_complete and mgmt_event functions are executed in
> process context and they are not called inside atomic sections. Thus,
> they should use GFP_KERNEL for memory allocation instead of GFP_ATOMIC.
> 
> Signed-off-by: Andre Guedes <aguedespe@gmail.com>
> ---
>  net/bluetooth/mgmt.c |    6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

All 3 patches have been applied to bluetooth-next. Thanks.

	Gustavo

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-06-19  3:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-07 22:05 [PATCH 1/3] Bluetooth: Use GFP_KERNEL in mgmt_handlers Andre Guedes
2012-06-07 22:05 ` [PATCH 2/3] Bluetooth: Use GFP_KERNEL in mgmt_pending_add Andre Guedes
2012-06-07 22:05 ` [PATCH 3/3] Bluetooth: Use GFP_KERNEL in mgmt events functions Andre Guedes
2012-06-19  3:55   ` Gustavo Padovan

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.