Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp2272816pxb; Mon, 11 Jan 2021 05:44:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJyiaTw1jLpD344TwoGTVSqlYyB0RxZJTH3AZkHVnpBVm4RM7Y10L1cpqPWUIwBirw+Uhunx X-Received: by 2002:a50:fc9a:: with SMTP id f26mr13846713edq.255.1610372697338; Mon, 11 Jan 2021 05:44:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610372697; cv=none; d=google.com; s=arc-20160816; b=KTjptc273xYVQmBEhjbn3PQPPtUy/YOGrEXx7KQ4dR/3xcFwlzPik9nBO13hH4yXj4 nt+Q7sTxWqM6tobr99zXeIB9S/GrQPf08FdEHzxQ2zBzPu4EP2o6UZP40z1N3L7MSFKa F9MysdaHU6GKd5KOngBsa6RpBExarHvauyOghbUi6kydRKGky1nDHKK188VM611h9RyE 6+le0SJubXv5bxHgcriCzZMGxRgL3if3VZhyQxfMKRmSx+QBwv6ADS/raYs1+r+Pms5t uO5zWpHdgulxMcg4FQd+seV1A8kgElNAiElzzRUHXvVFWxko+2wxGQgcHGXxeTuxNrw3 PnUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=GW1iVzS4um8AETaLzJJWPB9bBj5/vWD6SxFi0QEJFic=; b=L8Su/EyT/RqgwVxT/OSrEPWc+J7YHs6SYFLQ7/sNmIzuPg9sDSWgdSsv7a3xYOqPxF vSgmrbf+87Rewj1B4jQ1r9Y9a2KV68obE7qRBd/Qvhf8EsYqA7uh4hPQOcOO1AINLw0W doYq0w2wfSY3nmaS6j6dfa3NER7ogrs1qfRjNsvc9yMc7N6pn039K+3kSkvICc5FkXDm JH1nQDO7pCaAvyF07qIGlnkFZ1K2SabQI5I9o8KFpruqpU0voRLYQgspIlLdPBhmUavO fMV6fMenGTfq8uQwltrfJKgKnrjfWfw4y+IKqhZDJZRTpsCq68zPgOUT7QfaLffZL5/V Bfzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PguChEDh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f8si6490685ejc.50.2021.01.11.05.44.32; Mon, 11 Jan 2021 05:44:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PguChEDh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731148AbhAKNMj (ORCPT + 99 others); Mon, 11 Jan 2021 08:12:39 -0500 Received: from mail.kernel.org ([198.145.29.99]:58930 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731451AbhAKNLp (ORCPT ); Mon, 11 Jan 2021 08:11:45 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id AB1C622795; Mon, 11 Jan 2021 13:11:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610370665; bh=Gj/HyAUsIQo2G+cUZKMhSKG86mDRwD00QEa/a3fU9xs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PguChEDhnGe7CwkAjxhoxZ2ER60yePUl/NrOYpjMQbZ02mLkXlxhOpHoOAxL+gW+Y aSMxa6fNjHhzv8m3DaR1E1qMsI4tzugKKUszcvwQw4kjiJ32zL8FFLoL7VAFw5AAyt lqgmCYWVRwpo4eKvfi2xaNPKAVXSiUGHJETNqZH4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jakub Kicinski , Davide Caratti Subject: [PATCH 5.4 45/92] net/sched: sch_taprio: ensure to reset/destroy all child qdiscs Date: Mon, 11 Jan 2021 14:01:49 +0100 Message-Id: <20210111130041.315198350@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210111130039.165470698@linuxfoundation.org> References: <20210111130039.165470698@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Davide Caratti [ Upstream commit 698285da79f5b0b099db15a37ac661ac408c80eb ] taprio_graft() can insert a NULL element in the array of child qdiscs. As a consquence, taprio_reset() might not reset child qdiscs completely, and taprio_destroy() might leak resources. Fix it by ensuring that loops that iterate over q->qdiscs[] don't end when they find the first NULL item. Fixes: 44d4775ca518 ("net/sched: sch_taprio: reset child qdiscs before freeing them") Fixes: 5a781ccbd19e ("tc: Add support for configuring the taprio scheduler") Suggested-by: Jakub Kicinski Signed-off-by: Davide Caratti Link: https://lore.kernel.org/r/13edef6778fef03adc751582562fba4a13e06d6a.1608240532.git.dcaratti@redhat.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- net/sched/sch_taprio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/net/sched/sch_taprio.c +++ b/net/sched/sch_taprio.c @@ -1626,7 +1626,7 @@ static void taprio_destroy(struct Qdisc taprio_disable_offload(dev, q, NULL); if (q->qdiscs) { - for (i = 0; i < dev->num_tx_queues && q->qdiscs[i]; i++) + for (i = 0; i < dev->num_tx_queues; i++) qdisc_put(q->qdiscs[i]); kfree(q->qdiscs);