From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f53.google.com (mail-pj1-f53.google.com [209.85.216.53]) (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 A2F323009E2 for ; Sat, 15 Aug 2026 19:07:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.53 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786820848; cv=none; b=Uil69zFHsfkjRJ6fFf/bbptlFizYrGAj2cZmqkqsdVyawpajmp3Yo9eyACW2M9HF+gMP3FTvNt9Vg9gAw0AKHStGze/rc9tt7metolMIhyJelJs9iNfqVZFyiTgVFluTFvE9htlJbD1nrBUk0HsXceiUVl3x44+Yf3GqK4BX8uk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786820848; c=relaxed/simple; bh=hZ4gYeXG/cpS7vApLblCiJV4ysyLLA3A3BFTbWbGUMI=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=E74TnB5i/VU4XIkdDv9C5fvkAzMrqcmYeETEbECpGBWkL09pc41ICwCm3EgN2Sgs4/vJX/eXp8b7cDHaDTTukEbxhLoVLlNQkSS1+K4fJQeGm/h+3ysaV1ZfpuEZWurl80bbSSim31GytFzLm4jIZBNXRqZtxgEFEQ9/c6yxBgU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=HoaWilZR; arc=none smtp.client-ip=209.85.216.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="HoaWilZR" Received: by mail-pj1-f53.google.com with SMTP id 98e67ed59e1d1-38dfe910e9dso2167723a91.3 for ; Sat, 15 Aug 2026 12:07:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1786820847; x=1787425647; 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:content-type; bh=Q9z+ilZvjkaA4hnn8ASyfNzyt6HCWJVXyXA6SWj/0JA=; b=HoaWilZRTkMorUzLfzripBGlAJdfzd/LA//Y07wGqWv6x8AtNH+l1yOvDDirpefEUo pUq4yrBQQ+fQINXCXd+HRZep4zYzOQj9XGAPv32HFna98iJ36W2CWQvTk9o9gRU+4z/Y zSnvFcD8iN3vWZwqDUbLQ4uo/R/ow79U0HdMadEycQZQs2NksVHGS0IfLaCUkY1b2lgm V/jY2xraI1hj3RZho0teAopkVM5Wrm7JEzNKGCHZy65GrIfd/t4ENSlOuPW3jvQAluV/ v5PNTHCsFq6z03QSfhbQUls4J9PX2BGdVVunubVpul8Kxe06547mEz6+wrUVEQ++cQKz x3Xg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786820847; x=1787425647; 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:content-type; bh=Q9z+ilZvjkaA4hnn8ASyfNzyt6HCWJVXyXA6SWj/0JA=; b=e+vCsmLE0FTGwHRXwq/Geil23NMLhsUnyRp8cJCUhXxECoqVfAWay50ZDnAlOOzGWH G+l4E1+D54Nhx3irESVXx4zpxHvchbYX+YELiMMF7Ty6GA5BBG5FSVYEoRcgl/EOH9eT HyD7CJjaXwiqZLc3iIDcRmak1i/1pCgdyvV/GhKi8ei6KB5S8q9LEAOGRiCTBQ1UX+iK 7aikhKdt7iArRT7Af7Cj2EPNHG4LjUg23l/476oZrG0ii9e5K7Sdod35mAl5JZfZFFhn ZedUGmC9qmAELUWQwNSC3fXQM4G1ubLNVM/PbBt9fswVyOVkTqeYiRPJDj2zZaj0w/L2 kz9A== X-Forwarded-Encrypted: i=1; AHgh+RoEzCmTV6qLQliYtwKLfp/vvWYIOq8Oi9ozW0eULbS18UbYIQ2Uyn95wY5/VPHsb3uKmdeMGSUGlsWg9L0=@vger.kernel.org X-Gm-Message-State: AOJu0YyEYbVoBrnHc+eu8638yVEXv1vN5dOUIYno7YR/S9nLM4rLhq9+ EpX0DgLihjdt0U4c8RnJFR5jJ2PhDb4qnCEO821cjhKAa0I0BlNZSy6B X-Gm-Gg: AR+sD115b8vSEPO2kHa3ZNmxeWrg+8CdAJ4JBazXOHsp93TD86pnCKyRAGpoZKf6MsZ lI2tN+HKEIujIOLGcNm/yfaAhbrzrHJNU2i5Q7huyTdSKmtnbYMKzj6nRHrypnRwoHmjAiI1KXx iD829G6naXOB1CCIl3Lb71Ze4RqXbxRQHeEecNvMHz9Qb2uy2Nw4kQ+FLBEaUoDualtKmT2XsY1 fKv3uzURxKoSY+gakmk5ztwWYRZcVZqcUHw1BmTfMf3I2WvbfYWdQHcgSN6UPuHYzh14R1NLBfv VNopggpoMmyN2+c3Bh6I/8N+HA5JOAPpN6q9+nr1cV8yrwS3flEomAJSu1Ecf6OWcxE67sL0rB2 XjMhmg8PdDnTOo6qtLWczgf5CcOB6C2aMia83y+optzklxb/NxsFQGay086Fhy7TvjfiTszCUXi qkjb83NJJJYcYDqPozNVBJTUlIOZ4E55SRvC/FlbU5tiqowMOJTGAFlTAXmSzmVS0t//+3UxZfr m9g8gmPjrK0qgWFRQAe6x+x4Z38HqTT9TIayiKN08HLooYqZf8r9XVar4kD4HHwjZib/as4dDI+ TgekHJtXJiuNUcKANJIzEPDSJw0TrdkNiWUIBnGNT6KLmfllhA== X-Received: by 2002:a17:90b:4ec6:b0:38d:e658:5959 with SMTP id 98e67ed59e1d1-3933b80052cmr16223928a91.5.1786820846796; Sat, 15 Aug 2026 12:07:26 -0700 (PDT) Received: from ryzen.lan ([2601:644:8000:7a86::e34]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-39339cec8c8sm2971210a91.1.2026.08.15.12.07.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Aug 2026 12:07:26 -0700 (PDT) From: Rosen Penev To: linux-wireless@vger.kernel.org Cc: Johannes Berg , "John W. Linville" , linux-kernel@vger.kernel.org (open list) Subject: [PATCHv2 wireless] mac80211: stop tpt LED trigger timer before freeing trigger Date: Sat, 15 Aug 2026 12:07:24 -0700 Message-ID: <20260815190724.16943-1-rosenp@gmail.com> X-Mailer: git-send-email 2.55.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 The throughput (tpt) LED trigger timer is only stopped in ieee80211_stop_tpt_led_trig(), which is reached via ieee80211_stop_device() when the interface is brought down. On a hot unplug, the device is torn down through ieee80211_unregister_hw() without ever going through ieee80211_do_stop(), so the timer is never stopped. ieee80211_led_exit() then frees local->tpt_led_trigger (which embeds the timer) without cancelling it. The still-armed timer keeps firing and dereferences the freed tpt_trig, walking local->tpt_led's LED list in led_trigger_blink() -> led_blink_set_nosleep() on the freed rt2x00 LED class device, causing a use-after-free page fault in interrupt context. Call ieee80211_stop_tpt_led_trig() in ieee80211_led_exit(), before unregistering the trigger and freeing the struct, so the timer is always stopped and can never run after the trigger/LEDs are torn down. Fixes: e1e540685437 ("mac80211: add throughput based LED blink trigger") Assisted-by: opencode:hy3-free Signed-off-by: Rosen Penev --- v2: move static function instead of forward declaration net/mac80211/led.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/net/mac80211/led.c b/net/mac80211/led.c index b5600d223452..42dcd56eb983 100644 --- a/net/mac80211/led.c +++ b/net/mac80211/led.c @@ -194,6 +194,19 @@ void ieee80211_led_init(struct ieee80211_local *local) } } +static void ieee80211_stop_tpt_led_trig(struct ieee80211_local *local) +{ + struct tpt_led_trigger *tpt_trig = local->tpt_led_trigger; + + if (!tpt_trig->running) + return; + + tpt_trig->running = false; + timer_delete_sync(&tpt_trig->timer); + + led_trigger_event(&local->tpt_led, LED_OFF); +} + void ieee80211_led_exit(struct ieee80211_local *local) { if (local->radio_led.name) @@ -206,6 +219,7 @@ void ieee80211_led_exit(struct ieee80211_local *local) led_trigger_unregister(&local->rx_led); if (local->tpt_led_trigger) { + ieee80211_stop_tpt_led_trig(local); led_trigger_unregister(&local->tpt_led); kfree(local->tpt_led_trigger); } @@ -335,19 +349,6 @@ static void ieee80211_start_tpt_led_trig(struct ieee80211_local *local) mod_timer(&tpt_trig->timer, round_jiffies(jiffies + HZ)); } -static void ieee80211_stop_tpt_led_trig(struct ieee80211_local *local) -{ - struct tpt_led_trigger *tpt_trig = local->tpt_led_trigger; - - if (!tpt_trig->running) - return; - - tpt_trig->running = false; - timer_delete_sync(&tpt_trig->timer); - - led_trigger_event(&local->tpt_led, LED_OFF); -} - void ieee80211_mod_tpt_led_trig(struct ieee80211_local *local, unsigned int types_on, unsigned int types_off) { -- 2.55.0