From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3F6E8511194; Wed, 30 Sep 2026 16:15:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790784937; cv=none; b=HFRG59pA/KwwTGASVEyaqO4DEZzdUJ+nUwiB27YrjvymIpb+htqJX6UeQg1RqqauukdI5XHOUxwjyR385CLm9I8L80OYo61F4aIFJkboOxAtuO67ikR2XyNTIJr4jZgdsOtjZ9Co7c97Dx9/vPc8C75JU42GhSTUA+GL+oDvBPo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790784937; c=relaxed/simple; bh=xT39jbY1ho1h1w0gao74jvVqD2wNyDK43otG1gqEwls=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gc3cT3ZcWPLgOrN/XOoY0MR/ST4uTDPnbo7OyMjZ2Tk01X+lLgttboC1XjJEKxiJB9y3yixpAey9xJGgoLKP0jpwg+hYcbIqJVfamUEAM9nymCVyw9rPLuG0ZlvePGxmbEff0LCRoKstwifceEVzaq/UddRQ01LZuty54OnIYeo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=gE28Hmid; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="gE28Hmid" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BCE041F000FF; Wed, 30 Sep 2026 16:15:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1790784932; bh=iPql1TWnIe3w07WXNmZYpmLEVTRi5Yv1V3iE3GXOKpE=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=gE28HmidoGhHGzWi3XTZaM5jUaPwOJo9NMZyrzbkHVJFoGJfEVbntddZxfqosGfd0 r91/gr1vyCmZf1PszE31RNzigXZXTgcmLcPEZTVigUWZwnMpVfSfu7wlv6NmGDu9jB boHaN21j1k/FYzmP9tX+gDEVzLArOEXX2juLa2nA= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Eric Dumazet , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.1 303/982] drop_monitor: perform u64_stats updates under IRQ-disabled section Date: Wed, 30 Sep 2026 17:17:19 +0200 Message-ID: <20260930152423.321688122@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260930152416.775402466@linuxfoundation.org> References: <20260930152416.775402466@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Eric Dumazet [ Upstream commit fd098a23bf8fda7eae48db9b06e7c34fc4d228fa ] In net_dm_packet_trace_kfree_skb_hit() and net_dm_hw_trap_packet_probe(), u64_stats_update_begin() / u64_stats_inc() / u64_stats_update_end() were called after spin_unlock_irqrestore(&...drop_queue.lock, flags), when local IRQs had already been re-enabled. Tracepoint probes can execute in IRQ or softirq context. On 32-bit architectures, u64_stats_update_begin() disables preemption but not interrupts, relying on seqcount writes. If a nested interrupt occurs on the same CPU during the 64-bit stats update, the reentrant seqcount update can corrupt the seqcount state or stats value. Fix this by performing the 64-bit per-CPU stats update before releasing drop_queue.lock via spin_unlock_irqrestore(), ensuring local interrupts remain disabled during the u64_stats update. Fixes: e9feb58020f9 ("drop_monitor: Expose tail drop counter") Fixes: 5e58109b1ea4 ("drop_monitor: Add support for packet alert mode for hardware drops") Signed-off-by: Eric Dumazet Link: https://patch.msgid.link/20260722141743.3266924-3-edumazet@google.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/core/drop_monitor.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/core/drop_monitor.c b/net/core/drop_monitor.c index 768a79428dc92..a917faac7c5a8 100644 --- a/net/core/drop_monitor.c +++ b/net/core/drop_monitor.c @@ -528,10 +528,10 @@ static void net_dm_packet_trace_kfree_skb_hit(void *ignore, return; unlock_free: - spin_unlock_irqrestore(&data->drop_queue.lock, flags); u64_stats_update_begin(&data->stats.syncp); u64_stats_inc(&data->stats.dropped); u64_stats_update_end(&data->stats.syncp); + spin_unlock_irqrestore(&data->drop_queue.lock, flags); consume_skb(nskb); } @@ -984,10 +984,10 @@ net_dm_hw_trap_packet_probe(void *ignore, const struct devlink *devlink, return; unlock_free: - spin_unlock_irqrestore(&hw_data->drop_queue.lock, flags); u64_stats_update_begin(&hw_data->stats.syncp); u64_stats_inc(&hw_data->stats.dropped); u64_stats_update_end(&hw_data->stats.syncp); + spin_unlock_irqrestore(&hw_data->drop_queue.lock, flags); net_dm_hw_metadata_free(n_hw_metadata); free: consume_skb(nskb); -- 2.53.0