Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp939321ybx; Tue, 5 Nov 2019 07:52:03 -0800 (PST) X-Google-Smtp-Source: APXvYqzvxZT5m3oGJPWbhHJs6yS0ItGzVdmmw2A+oaGN9lI76220JG4VSYi11y5v2FPJe3sLGYvv X-Received: by 2002:a17:906:76c3:: with SMTP id q3mr30250378ejn.199.1572969123722; Tue, 05 Nov 2019 07:52:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1572969123; cv=none; d=google.com; s=arc-20160816; b=nn9Xtb4OH0GTCmXdrP1vibbTifxqSWdMS9YDZK7ZuSbgaqvoqfQOJqbShXQVnobd14 1C7xV37ddSKBVzs0zaQAEwUfz9uc19FRNYuDId/VLBQ/KOyCWOhd3mWqEOkshFf14r2k T3cXxpCGJLWLIP2UV3Hr/e1/xh3R97JJMuyXxU5HOD7Fcrx+mEYaeQiAQUFkTmZlyahW 6UDbwdQxY/2asls6xr4Szy0rlFfKs0TtifsBPVJWlXHbWLM/E+ceKLgRRwFeCYO+Dw1z PqU8rrk2UPO/eRAQ9Z1WT0/dVgVQ1xdbSQ7nbFfq9Fh9h0ioISCjpAmY2z8JEn0s+Q4f pvtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=E0dV3sa3iQTivjDRJmppOUx6O6Df8UUVFYaPoLAUNkI=; b=1KsJyGhAocrgIpkOPBCG9uO76Me/P6BoCAHGQf6prwk6mHAC0zwSlEJfqceFW8uNkc rXwNx/YUhYdWBc1Ov+pU9ujZRQNg7XAbJ7a1m3jEDxirYcLrnyVZO8R/gkroAYgio2fE 9KvJgxD63tcBtOQ6vXJcauEftH1jX4tgWobMfIGtZ9k9iH9ryBaGzoWXrt+QeRpfwePF WEA6UHOoh3EON5GTXf49jMoOQLmuFcCBvA/2FMJ6YmJdWbEh4RhsZ7ve508G1KI15kV5 Nfq36bN3c8qoSEvPn0Z5twi2VxuCoV+Rjk8CSb+N1RVybGTNAou7qOw+Fd+Bizv7rgC7 B1Ig== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id hh12si13128340ejb.343.2019.11.05.07.51.38; Tue, 05 Nov 2019 07:52:03 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390014AbfKEPvE (ORCPT + 99 others); Tue, 5 Nov 2019 10:51:04 -0500 Received: from mx1.redhat.com ([209.132.183.28]:46990 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389571AbfKEPvD (ORCPT ); Tue, 5 Nov 2019 10:51:03 -0500 Received: from mail-lf1-f70.google.com (mail-lf1-f70.google.com [209.85.167.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 71F9885363 for ; Tue, 5 Nov 2019 15:51:03 +0000 (UTC) Received: by mail-lf1-f70.google.com with SMTP id k30so3592471lfj.5 for ; Tue, 05 Nov 2019 07:51:03 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=E0dV3sa3iQTivjDRJmppOUx6O6Df8UUVFYaPoLAUNkI=; b=I3TGkysj1tNqW+yhIXKasGCI2P/CkTRTd0Zt2+g6TeLjBHynZxr8CmFHs6R4sd5i5X IBWB+MCbWHOT9EY+OAYbMXNIGNHdCkjiWn3G7qZOVjuYRscVqZ7FzIhxk6aSFcczRQfy BkWgff1aqqwxedUYxuXusLlVbUSJLESzhrjUXi3KzHwqkakVhL1I03OdtXJ5b4YLJ2vj GXEBxgsb/A9mxphLudFA2cXKUTXaRO9bjWhZWurk7Bu2D4O3av2BGuO5442cJw/HwbG6 Ki3/54kJMuwVehpli7jtpUSxI7DRPxpk889R+KtOUHMbkXHy9vzniBJNDkuYA5mMBgGK Kldg== X-Gm-Message-State: APjAAAUL9lRCf2oIYXQZrwvOC589ijRqLqOMujU0+U5QJ4i+pgILti6L N10pYt2aJuzKqTLBgM5BgLxbmHu72VZ1WrFquo+1uuUE0qSrvNH7bj3X9JvZQLjHC7+kRUhwq4E D9yS7Eu23/CJV/fP11TmEVLD1hIg= X-Received: by 2002:a2e:8204:: with SMTP id w4mr24160633ljg.212.1572969061534; Tue, 05 Nov 2019 07:51:01 -0800 (PST) X-Received: by 2002:a2e:8204:: with SMTP id w4mr24160622ljg.212.1572969061379; Tue, 05 Nov 2019 07:51:01 -0800 (PST) Received: from alrua-x1.borgediget.toke.dk ([2a00:7660:6da:443::2]) by smtp.gmail.com with ESMTPSA id c14sm9276346ljd.3.2019.11.05.07.51.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Nov 2019 07:51:00 -0800 (PST) Received: by alrua-x1.borgediget.toke.dk (Postfix, from userid 1000) id E03F21818B5; Tue, 5 Nov 2019 16:50:59 +0100 (CET) From: =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= To: linux-wireless@vger.kernel.org Cc: =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= , Johannes Berg Subject: [PATCH] net/fq_impl: Switch to kvmalloc() for memory allocation Date: Tue, 5 Nov 2019 16:49:51 +0100 Message-Id: <20191105154951.546285-1-toke@redhat.com> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org The FQ implementation used by mac80211 allocates memory using kmalloc(), which can fail; and Johannes reported that this actually happens in practice. To avoid this, switch the allocation to kvmalloc() instead; this also brings fq_impl in line with all the FQ qdiscs. Fixes: 557fc4a09803 ("fq: add fair queuing framework") Reported-by: Johannes Berg Signed-off-by: Toke Høiland-Jørgensen --- include/net/fq_impl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/net/fq_impl.h b/include/net/fq_impl.h index 107c0d700ed6..d3873db91c71 100644 --- a/include/net/fq_impl.h +++ b/include/net/fq_impl.h @@ -313,7 +313,7 @@ static int fq_init(struct fq *fq, int flows_cnt) fq->limit = 8192; fq->memory_limit = 16 << 20; /* 16 MBytes */ - fq->flows = kcalloc(fq->flows_cnt, sizeof(fq->flows[0]), GFP_KERNEL); + fq->flows = kvcalloc(fq->flows_cnt, sizeof(fq->flows[0]), GFP_KERNEL); if (!fq->flows) return -ENOMEM; -- 2.23.0