From patchwork Fri Jan 31 15:45:39 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz.Markowski@tieto.com X-Patchwork-Id: 315710 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from maxx.maxx.shmoo.com (maxx.shmoo.com [205.134.188.171]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4A21B2C009C for ; Sat, 1 Feb 2014 02:46:09 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 581B59C124; Fri, 31 Jan 2014 10:46:06 -0500 (EST) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id zCTcZxw7z3QO; Fri, 31 Jan 2014 10:46:06 -0500 (EST) Received: from maxx.shmoo.com (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 9E45F9C13E; Fri, 31 Jan 2014 10:45:57 -0500 (EST) X-Original-To: mailman-post+hostap@maxx.shmoo.com Delivered-To: mailman-post+hostap@maxx.shmoo.com Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id B2FC69C140 for ; Fri, 31 Jan 2014 10:45:56 -0500 (EST) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id HzRRT5MRLDzS for ; Fri, 31 Jan 2014 10:45:51 -0500 (EST) Received: from mail-ee0-f49.google.com (mail-ee0-f49.google.com [74.125.83.49]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (not verified)) by maxx.maxx.shmoo.com (Postfix) with ESMTPS id 9A7029C124 for ; Fri, 31 Jan 2014 10:45:51 -0500 (EST) Received: by mail-ee0-f49.google.com with SMTP id d17so2349245eek.8 for ; Fri, 31 Jan 2014 07:45:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tieto.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=zDoQhV7Bn+rvTVqwsHqGTXoIYOrPFDYMrSgECU+L5O4=; b=wHJppNhn+j7uWWkvcW/mnc1k3MIy2dmmSWDszcsHyZAOpBD66E3tQ+GEXL776Tbq1v A1426odeC95+LcCL4fYtFsBbrN2uogAOfuC6lE3paD4kIFZZlp3s1OS7tCHOUFtZSS5Z kPdeCY+jqPJAmtz6ycMa6JqP7KtAgAmRt849Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=zDoQhV7Bn+rvTVqwsHqGTXoIYOrPFDYMrSgECU+L5O4=; b=hb3FQeqBHbG2NYB+V/uZcuZJY+Y7abu2CEbiQl2bHUHh/yGyA9oxEmwUJAJUuJkw2D 6QL0DLhaxpM/TPu/2HbCIOBiGKfqm9XdGpLiC6OsXt3c0tZaQ6x7upuFcxp+JYc2hqBh kzzY++DcLIAP4wO9Tnf1wsgABai2m97drkSUHi6VweprTmyuZ8k+DL90Pb4PIfRxtnpp OzfVyTOjQZ+d1HTQzSXRKN4AEYocqbIzNy28v3K3DHCb9eCrVed4YvdRb6h8n8P38OX7 4yYRZc542f+pAOU+r4PgzP+hS4QtOjzKrBTqIe7+c9o0vfzL+xwnba7OFveOegOxaCT8 SYmw== X-Gm-Message-State: ALoCoQnMgnCHlS2JBgps63ZP6KinmFQWOnomKNFkDH6NZWVfl95pioTWXNqP1b/sQ2AVktnGblY6dzW4rWz7ZEyrnJ04pzAIrafiddM+971ahI6Rb1eN2WQ= X-Received: by 10.14.184.66 with SMTP id r42mr4520186eem.86.1391183150477; Fri, 31 Jan 2014 07:45:50 -0800 (PST) Received: from E4300.vivaldiego.wroclaw.pl (v22-98-181.vivaldiego.wroclaw.pl. [195.22.98.181]) by mx.google.com with ESMTPSA id k41sm37772395eey.0.2014.01.31.07.45.49 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 31 Jan 2014 07:45:50 -0800 (PST) From: Bartosz Markowski To: hostap@lists.shmoo.com Subject: [PATCH 1/2] nl80211: allocate more memory for channel_switch cmd Date: Fri, 31 Jan 2014 16:45:39 +0100 Message-Id: <1391183140-3437-2-git-send-email-bartosz.markowski@tieto.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1391183140-3437-1-git-send-email-bartosz.markowski@tieto.com> References: <1391183140-3437-1-git-send-email-bartosz.markowski@tieto.com> X-DomainID: tieto.com X-BeenThere: hostap@lists.shmoo.com X-Mailman-Version: 2.1.11 Precedence: list List-Id: HostAP Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: hostap-bounces@lists.shmoo.com Errors-To: hostap-bounces@lists.shmoo.com From: Michal Kazior Once a certain threshold was reached (depending on number of IEs and BSSes) channel switch was failing with -ENOBUFS meaning nlmsg was too small to fit the whole command. Pre-allocate a big buffer for channel switch to avoid this. 64KiB seems reasonable from a practical point of view as it should handle at least 8 BSSes. Signed-off-by: Michal Kazior --- 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 81f20b3..77149ba 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -11596,7 +11596,11 @@ static int nl80211_switch_channel(void *priv, struct csa_settings *settings) settings->cs_count))) 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;