Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp941163ybx; Tue, 5 Nov 2019 07:53:59 -0800 (PST) X-Google-Smtp-Source: APXvYqwakO8fW9lOnOrHOk6/v4rfkN5XmshbUPbeQU7ql3+dBvyVIF4B6HgBWaBCFv87hcgfnOuG X-Received: by 2002:a50:8a88:: with SMTP id j8mr37593947edj.35.1572969238916; Tue, 05 Nov 2019 07:53:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1572969238; cv=none; d=google.com; s=arc-20160816; b=rHnLNx13S8i4+dvnkuu9GE6hpTejuqhKKLL5tVqnsgog2gDv6l7TnY0RvN91EXTtqP nESXFO5ZEKsqK5dpcbxTQXOZ2fNayx1kAYhnabg0N5QNbgx8LeOUjRGL1fmcLBBsjeGD frRlSTuM7KH+8JZamMAJvLcSAbVm4mXp3uBVnPDp0dlz64K+96aaqLgMIBdDhYnIq84P 0ME7dTFgHtMe1w1sppDGXGfMmTEB5CJKsBrPM58Wdf3rYYwRQ+ucpBgqCqGzRSbAc/ld ZbVOKmGWZiwIADgdBrpySiRrbUSJ8RMHQdO0kf4fHUNf9A9xeMIi87nQkbTY44FvX3M8 NYpQ== 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 :user-agent:references:in-reply-to:date:to:from:subject:message-id; bh=1PUWjF6WqP+n8hah691Chse1xxtMDsLJ+sk86pjS7ok=; b=SUaJBqdTvE8aW43vwF9UlLYwbmNora8DtdsDZGxotALFFZN2IZ2wXP94Vg3YxJ/Njz oDV2dkhZzdIYdx1Q4Nknhj3JJ/TiMy33xS93qSnJOdX1V0vHXFgBlZEi8lgJVf6F1p37 P2qkGACNmKEPDnpn9UaN4JHAJjFHlb80/nb9bFtoEq74mtXTA/vIdPJH6BG/mgjwhxlT PDpiGYXnX9VgIWTXUwRLL4SVXwFLhWDWQwE53Xqa3A5o/+B9wEpPR6mLA13YexUMQRGc CgLQII97jy7W2x/WGzoKTK7WcKl+5bCP0bw4hV89OBzj75T1uUxhu4Aoe7fiDarukwW3 jIqQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k11si892377ejv.152.2019.11.05.07.53.33; Tue, 05 Nov 2019 07:53:58 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389652AbfKEPvk (ORCPT + 99 others); Tue, 5 Nov 2019 10:51:40 -0500 Received: from s3.sipsolutions.net ([144.76.43.62]:38404 "EHLO sipsolutions.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389760AbfKEPvk (ORCPT ); Tue, 5 Nov 2019 10:51:40 -0500 Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.92.2) (envelope-from ) id 1iS17K-0002CI-Qb; Tue, 05 Nov 2019 16:51:38 +0100 Message-ID: <0690b548e233fba3758df0ce1eeca1c0803a62c4.camel@sipsolutions.net> Subject: Re: [PATCH] net/fq_impl: Switch to kvmalloc() for memory allocation From: Johannes Berg To: Toke =?ISO-8859-1?Q?H=F8iland-J=F8rgensen?= , linux-wireless@vger.kernel.org Date: Tue, 05 Nov 2019 16:51:37 +0100 In-Reply-To: <20191105154951.546285-1-toke@redhat.com> References: <20191105154951.546285-1-toke@redhat.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.30.5 (3.30.5-1.fc29) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On Tue, 2019-11-05 at 16:49 +0100, Toke Høiland-Jørgensen wrote: > 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); You need a corresponding kvfree(), no? johannes