diff mbox

batman-adv: Don't allocate icmp packet with GFP_KERNEL

Message ID 1274295600-16987-1-git-send-email-sven.eckelmann@gmx.de
State Superseded, archived
Headers show

Commit Message

Sven Eckelmann May 19, 2010, 7 p.m. UTC
A new buffer for a packet is created when a icmp packet is received.
This happens in a context with disabled irq. Thus we are not allowed to
sleep or call function which might sleep. kmalloc must be called with
GFP_ATOMIC instead of GFP_KERNEL to ensure that it does not sleep.

Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de>
---
 batman-adv-kernelland/icmp_socket.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Comments

Marek Lindner May 21, 2010, 3:25 p.m. UTC | #1
On Thursday 20 May 2010 03:00:00 Sven Eckelmann wrote:
> A new buffer for a packet is created when a icmp packet is received.
> This happens in a context with disabled irq. Thus we are not allowed to
> sleep or call function which might sleep. kmalloc must be called with
> GFP_ATOMIC instead of GFP_KERNEL to ensure that it does not sleep.

Applied in rev 1671.

Thanks,
Marek
diff mbox

Patch

diff --git a/batman-adv-kernelland/icmp_socket.c b/batman-adv-kernelland/icmp_socket.c
index 33d2714..becbb5b 100644
--- a/batman-adv-kernelland/icmp_socket.c
+++ b/batman-adv-kernelland/icmp_socket.c
@@ -292,7 +292,7 @@  static void bat_socket_add_packet(struct socket_client *socket_client,
 	struct socket_packet *socket_packet;
 	unsigned long flags;
 
-	socket_packet = kmalloc(sizeof(struct socket_packet), GFP_KERNEL);
+	socket_packet = kmalloc(sizeof(struct socket_packet), GFP_ATOMIC);
 
 	if (!socket_packet)
 		return;