From 93cf884ebae8bbc70bd054a8c9aa3653a6b9503a Mon Sep 17 00:00:00 2001
From: Maxime Bizon <mbizon@freebox.fr>
Date: Thu, 20 Mar 2014 16:35:10 +0100
Subject: [PATCH 14/18] allocate more memory for channel switch cmd

---
 src/drivers/driver_nl80211.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 090b204..0ce4e96 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -11236,7 +11236,11 @@ static int nl80211_send_tdls_mgmt(void *priv, const u8 *dst, u8 action_code,
 	if (!dst)
 		return -EINVAL;
 
-	msg = nlmsg_alloc();
+	/* each interface channel switch request can be sizable as it contains
+	 * a beacon and possibly a probe response. this size varies depending
+	 * on the number of IEs. pre-allocate memory for the nlmsg. this could
+	 * be probably caculated/estimated but 64KiB seems like a sane value */
+	msg = nlmsg_alloc_size(64 * 1024);
 	if (!msg)
 		return -ENOMEM;
 
-- 
1.7.9.5

