Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1905077ybl; Tue, 3 Dec 2019 14:45:46 -0800 (PST) X-Google-Smtp-Source: APXvYqyZNVDum1dttZ2QeB9nH+Scjt8FGLJztFvIWgAgSMWnwO+cdjyTMFg3phAr4OB4JWDqCblM X-Received: by 2002:a05:6830:10f:: with SMTP id i15mr187906otp.199.1575413146449; Tue, 03 Dec 2019 14:45:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575413146; cv=none; d=google.com; s=arc-20160816; b=nhPfa+/kMA0hZsz23oBDM8KZS5dTRAddl1iC8kJvm8iMk1gtZvjVqay3K5dCpQuY9d yYE76HMObCNOLTMbDSFRMueKxP99mj73HXkdIze5VvqZ6+cWKFPNPyGvVDYqd1BnehA6 3ZUe7jJq3/eYMoHVzoNXZeHm40dh3TbDxsJFo9skcwmKTS/ztD6kjYEPJp+8aB4ZXvd6 4bvDweWN7wB7ZQkdo2W4Q69eMDZKs01nxJOSgmyitq7Xx71n+kuYQzOaf1sMORDGQc3E YKUpSvbctkR7LvpW8o810uNR7EhBVY4j6jY5rbU4WYgnqTcFIrQwXHf2iNsnQX1FMQ1u CTJw== 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:message-id:date:subject:cc:to :from:dkim-signature; bh=zmn8R4gk0NSVBq3n4M95F8jTu9ZDg6SZ0sQL2Bf/9x8=; b=Oft6CIdwhGMCXjhYPjbTVzReoM/53mfD4nFChRyHJk9iHD1/bat+MD8tBIEAfwBBT2 h1XHcUDERmqN4NzLPbt+BtvX6ixNjcuD8893fikDmZDddPrBfYX+Ujpm2S4aFfujUDIC T6En+ylaCMWDRhywKdyTV4dxbxkfSgAV9O7srqehy4cJ5rTvarLd+0WcvDs3zcP82E1t vmAthSS4SZFE+fep1P0R6FvQTfbIo32gmj798coX7RoIR+KYs1iVU8HHxz35znFyRawj ehB6R8R0msMDjjcCAgvJajzCqjdJgyImWhVCWEvtMbJQ/RLWHK4ZHrrGX8f9S5VEYfjx bJOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=HEAZZgjF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 z18si2088875otq.121.2019.12.03.14.45.33; Tue, 03 Dec 2019 14:45:46 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=HEAZZgjF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728974AbfLCWox (ORCPT + 99 others); Tue, 3 Dec 2019 17:44:53 -0500 Received: from mail.kernel.org ([198.145.29.99]:32880 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728673AbfLCWou (ORCPT ); Tue, 3 Dec 2019 17:44:50 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DF07220803; Tue, 3 Dec 2019 22:44:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1575413089; bh=OWfCKaB2Nn/jWj+jLTsqNNgX25+36blG7TPdm0AhVCk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HEAZZgjFnBD04EfTMR/DO6Rmi3+GWjvj71os4KNU0XwDWQkAtoq2zFXMOAIQIw+yC 33RQpjX4a3xkIb+1qy7JWxd4Kboa4qs/X/sqMN2TXW8CEHnt4/NDCxHx+0b0YIXlrR 0sAmU/giZ8hOLjbGAEpizZoX1QkB1qdqjrxmv0XE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johannes Berg , =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= , Johannes Berg , Sasha Levin Subject: [PATCH 5.3 090/135] net/fq_impl: Switch to kvmalloc() for memory allocation Date: Tue, 3 Dec 2019 23:35:30 +0100 Message-Id: <20191203213036.344531573@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191203213005.828543156@linuxfoundation.org> References: <20191203213005.828543156@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Toke Høiland-Jørgensen [ Upstream commit 71e67c3bd127cfe7863f54e4b087eba1cc8f9a7a ] 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 Link: https://lore.kernel.org/r/20191105155750.547379-1-toke@redhat.com Signed-off-by: Johannes Berg Signed-off-by: Sasha Levin --- include/net/fq_impl.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/net/fq_impl.h b/include/net/fq_impl.h index 107c0d700ed6f..38a9a3d1222b7 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; @@ -331,7 +331,7 @@ static void fq_reset(struct fq *fq, for (i = 0; i < fq->flows_cnt; i++) fq_flow_reset(fq, &fq->flows[i], free_func); - kfree(fq->flows); + kvfree(fq->flows); fq->flows = NULL; } -- 2.20.1