From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qk1-f172.google.com (mail-qk1-f172.google.com [209.85.222.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A969354763 for ; Tue, 9 Jun 2026 00:54:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780966443; cv=none; b=C36frp6UOB72s5uDsxlQq0ARasBGGEuzeMR0KNCmUQloaEQc7QItfjsQnKzEq6FWBtM8twiYYnFxdpOeT8Ga+VtQo6Trq06KDrSYEWQo9jn1S+M/x7p7HGZXlfU0zIeccHxth/wRmzQ9dXygSOqCw8oii3YjtV/s+SXXvjcC+Xs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780966443; c=relaxed/simple; bh=PeMGTAiBDA1zLaaR/tkHWppVR0Mrqa7pwBx29pP1yq0=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=KGVUMPNodMn2lxvk/PezW1Fn9CU+2JecUNJRAZrHyEsz0hjDMJaIkiApxI/qKylbMaCDY5vTzHutSydo2oZpar4rlEBlcQn+O2BRmIcktl0/jOg1NmfXsHLFck/wDacSGPXvO8aqC1/K6d/MQxpf0E6ML6+CsrHTmUkKankrN+w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=trailofbits.com; spf=pass smtp.mailfrom=trailofbits.com; dkim=pass (2048-bit key) header.d=trailofbits.com header.i=@trailofbits.com header.b=Mr75bK+X; arc=none smtp.client-ip=209.85.222.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=trailofbits.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=trailofbits.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=trailofbits.com header.i=@trailofbits.com header.b="Mr75bK+X" Received: by mail-qk1-f172.google.com with SMTP id af79cd13be357-91588056619so338915985a.2 for ; Mon, 08 Jun 2026 17:54:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=trailofbits.com; s=google; t=1780966442; x=1781571242; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=SLIjYpf1CuOXyUq/M7hnmedCnWq0PTsVfjdjpT3u0Mo=; b=Mr75bK+XSrCTmwWB3STn/l5lAm5EDPOaL7vEpwBHra2DkTMw69nFUKDDPpbuucF/ea k7ol9Fa+gkozAh25rAJhjLaX/sk8ENWvD0u3LP45/gU9sUUK402vwPF8j7EY+eeHFbYK XaW6z/cmXChP7y28/dyBonNdobicxAMbuSXVvcdZS1teTbldVVLBj2r+LwweYCz+4Oym SwrvVCL4t9KrD8GO/RxntAg53aRPBVeMsiehBkliCytRjA5IUmDvSuIo1mKTxudoIBfb GLDKo4hmycNo8C5V/XcjvkygxssCHEioKFRq13Wi3wX6Z9i0DJbyao5CCpC7eTraPg12 h1vA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780966442; x=1781571242; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=SLIjYpf1CuOXyUq/M7hnmedCnWq0PTsVfjdjpT3u0Mo=; b=JOjlAaIw03lg69+oNqhvPSCX/CQuA86981UIFjLh8DBZKFrA+nWpqmgl+D4IJhTo+i 6NRKSnJuzIv4yVU0sxoiG14U6s4ZJWEb+yvD9SX6N6kTLyENA1RP7IBC4odG/VXWoh4J 9E6urD3CUJE8JrW7iQ3GSTjbzDe6t6kYt7LR+bgOsCL7qOpAaO0Pnh36IjRztJTSFK1p /NYriMNLc5oCoUsvv/HoLj1/RQKBeOKjJcOmK/VPGfeYbDh7Nw3pIc1uSTxvcQ6XAuA5 gLTufK0JYfiUy5o5n+jtwezKUqPaMqkCIQ/ymASDRWpbXnDDPL4b+81kYq6JPlpjJV2+ J7Yw== X-Forwarded-Encrypted: i=1; AFNElJ8gWJIYpxpMiazl+uS2ZQqhxsKpEmKlIkOsIy6BZdiPJePPENexjZsI1szc0BCbRIyXn7SEEdc1bTfTBL8=@vger.kernel.org X-Gm-Message-State: AOJu0YxrnoAFoLQc7icXDVZmWrU4Z2eYvrlKqSDEHg1lrMs2cLhh3plf OqaDsmmWKSLYr3RmhTZ6SEAPzobZ8Qp962t12/7OXtTmJAvu+qAbZIgS/c/cAAHYOB4= X-Gm-Gg: Acq92OEVnbXTakc/GOVTK3Cjw5Z0wjGUYLRLE5af21L8fIavRJMnUZI9oFl7/Y9OxMs Kkvg/wVaoPed+6kW/jTdR2qo7l588PkJyiZXCVy1lkhEVHQJt4+cder1JFGhpD0hdX1wg6Uwlg6 DjQBtBAw5e2xP/qYc7laCCLFhQShFP8n7Ev22d55pMpxTVwWYHgVHD7e4SxDCOfrumXGlTogp49 POGSCUeNsDFMENUGDi/iQfK20vmeJUkPGX+o/MjjyKwqx+7zwqLknPKwNnUSwfEuhWUJTi/kKVc 0Nqr0cCUuw5O0rfoJb6ocE+UBBcDSawsWjPhnfhzZ6jMj1aLhO5rwF9zGhWgSvMrHYuPa5BydVz EHiuVNMbOARHXmIg7Vss35hbOLZRlRt3EaFNa00BBZkn0KjNv1B3fcX+hCoSdw8EAzfQJ1egLP5 DIP67DOK+7r+HWmzYR0qkTmpKI859abKwt1Wth6Q== X-Received: by 2002:a05:620a:454b:b0:915:7732:ea7c with SMTP id af79cd13be357-915a9da3801mr3019464085a.43.1780966441679; Mon, 08 Jun 2026 17:54:01 -0700 (PDT) Received: from localhost ([161.35.96.86]) by smtp.gmail.com with UTF8SMTPSA id af79cd13be357-9158a2359ecsm1928705985a.14.2026.06.08.17.54.00 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 08 Jun 2026 17:54:01 -0700 (PDT) From: Samuel Moelius To: Jamal Hadi Salim Cc: Samuel Moelius , Jiri Pirko , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , netdev@vger.kernel.org (open list:TC subsystem), linux-kernel@vger.kernel.org (open list) Subject: [PATCH] net/sched: hhf: clear heavy-hitter state on reset Date: Tue, 9 Jun 2026 00:49:38 +0000 Message-ID: <20260609004937.1240807.c0dcec938172.hhf-reset-stale-classifier@trailofbits.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit HHF reset does not clear the classifier state used to identify heavy hitters. Packets after reset can therefore be scheduled using flow history from before the reset. The reset operation should return the qdisc to an empty state. Clear the heavy-hitter classifier tables when HHF is reset. Assisted-by: Codex:gpt-5.5-cyber-preview Signed-off-by: Samuel Moelius --- net/sched/sch_hhf.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/net/sched/sch_hhf.c b/net/sched/sch_hhf.c index 96021f52d835..1698c1b54dec 100644 --- a/net/sched/sch_hhf.c +++ b/net/sched/sch_hhf.c @@ -461,12 +461,34 @@ static struct sk_buff *hhf_dequeue(struct Qdisc *sch) return skb; } +static void hhf_reset_classifier(struct hhf_sched_data *q) +{ + int i; + + for (i = 0; i < HH_FLOWS_CNT; i++) { + struct hh_flow_state *flow, *next; + struct list_head *head = &q->hh_flows[i]; + + list_for_each_entry_safe(flow, next, head, flowchain) { + list_del(&flow->flowchain); + kfree(flow); + } + } + WRITE_ONCE(q->hh_flows_current_cnt, 0); + + for (i = 0; i < HHF_ARRAYS_CNT; i++) + bitmap_zero(q->hhf_valid_bits[i], HHF_ARRAYS_LEN); + q->hhf_arrays_reset_timestamp = hhf_time_stamp(); +} + static void hhf_reset(struct Qdisc *sch) { + struct hhf_sched_data *q = qdisc_priv(sch); struct sk_buff *skb; while ((skb = hhf_dequeue(sch)) != NULL) rtnl_kfree_skbs(skb, skb); + hhf_reset_classifier(q); } static void hhf_destroy(struct Qdisc *sch) -- 2.43.0