From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 40E541741D9; Tue, 18 Jun 2024 12:38:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718714336; cv=none; b=UV2e/oV1TxFLRvOirCZcd7cd+x52KWqgLFRhswGaP43lCBFjLgCg03gzDcKqZIPhFfPZQWi2cZqmbZH6ylcfkTXCTcWr25KrE2ctejQa0fYoxpy39WbbYlWa/Xu4oBTT0SOeyPK0Vs1TT7zAYlfkYeHIybL6zPynpuHYTPFdC9I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718714336; c=relaxed/simple; bh=Zj9d84qwyrY4m2ytLMJ7KkWT6CrOEfG4t29RPvVaUJk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=X8SUQjN3W+0PaULTheedjVzjc8qnB/za9Lew9bpp6/UEJ2twCB6KjrhzYUK4jgcLm+w+4I2iofj7sxI03ZXm5E3+FgJ9jZtKq5+2Lq+X1U81m45mveeINU3hvNCId5jz9HjmvG46UVXNeLYJDEo3O22nawAYSsyUw8JGxXfH+mU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=V2Pi2wbU; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="V2Pi2wbU" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D9EC1C4AF1D; Tue, 18 Jun 2024 12:38:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718714336; bh=Zj9d84qwyrY4m2ytLMJ7KkWT6CrOEfG4t29RPvVaUJk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V2Pi2wbUzlqlFaUj5JHCtdIVxh7+KoOuFiLnxtcuGzdmoRr8c5wdhLj6LQZliyn7v yfK/naxrv+PflqcKApiiaFOgEQ0pLpO1v3zi9obL1uYOoxn/kccwkhkuLhKMle1N4P 4lvieU+mZv2Kq+geTXwXEyTq78DECj5vRipzvpAY17bfyL8tG9zf9P+LCgXrbiaaQ1 s2Rk7jFXRTTqrUZvBGkwFeCx6nnhBxnuZLJDByaBSKkJ/6bv6WnimdTsWFkLMkrjif rC67RsoIeL09Gl8vMHkIBbtOmsu9sEN/OjQD8hfMcHWJDx7OljAINoGkknpbSs0Nxn Wa0hn2PwV57Ng== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Johannes Berg , syzbot+8830db5d3593b5546d2e@syzkaller.appspotmail.com, Sasha Levin , johannes@sipsolutions.net, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux-wireless@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH AUTOSEL 6.6 13/35] wifi: mac80211: handle tasklet frames before stopping Date: Tue, 18 Jun 2024 08:37:33 -0400 Message-ID: <20240618123831.3302346-13-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240618123831.3302346-1-sashal@kernel.org> References: <20240618123831.3302346-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.6.34 Content-Transfer-Encoding: 8bit From: Johannes Berg [ Upstream commit 177c6ae9725d783f9e96f02593ce8fb2639be22f ] The code itself doesn't want to handle frames from the driver if it's already stopped, but if the tasklet was queued before and runs after the stop, then all bets are off. Flush queues before actually stopping, RX should be off at this point since all the interfaces are removed already, etc. Reported-by: syzbot+8830db5d3593b5546d2e@syzkaller.appspotmail.com Link: https://msgid.link/20240515135318.b05f11385c9a.I41c1b33a2e1814c3a7ef352cd7f2951b91785617@changeid Signed-off-by: Johannes Berg Signed-off-by: Sasha Levin --- net/mac80211/ieee80211_i.h | 2 ++ net/mac80211/main.c | 10 ++++++++-- net/mac80211/util.c | 2 ++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index fefaa9e902a2f..fb55014c0e898 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h @@ -1846,6 +1846,8 @@ void ieee80211_link_info_change_notify(struct ieee80211_sub_if_data *sdata, void ieee80211_configure_filter(struct ieee80211_local *local); u64 ieee80211_reset_erp_info(struct ieee80211_sub_if_data *sdata); +void ieee80211_handle_queued_frames(struct ieee80211_local *local); + u64 ieee80211_mgmt_tx_cookie(struct ieee80211_local *local); int ieee80211_attach_ack_skb(struct ieee80211_local *local, struct sk_buff *skb, u64 *cookie, gfp_t gfp); diff --git a/net/mac80211/main.c b/net/mac80211/main.c index 4548f84451095..d7f67d81d5af9 100644 --- a/net/mac80211/main.c +++ b/net/mac80211/main.c @@ -301,9 +301,8 @@ u64 ieee80211_reset_erp_info(struct ieee80211_sub_if_data *sdata) BSS_CHANGED_ERP_SLOT; } -static void ieee80211_tasklet_handler(struct tasklet_struct *t) +void ieee80211_handle_queued_frames(struct ieee80211_local *local) { - struct ieee80211_local *local = from_tasklet(local, t, tasklet); struct sk_buff *skb; while ((skb = skb_dequeue(&local->skb_queue)) || @@ -328,6 +327,13 @@ static void ieee80211_tasklet_handler(struct tasklet_struct *t) } } +static void ieee80211_tasklet_handler(struct tasklet_struct *t) +{ + struct ieee80211_local *local = from_tasklet(local, t, tasklet); + + ieee80211_handle_queued_frames(local); +} + static void ieee80211_restart_work(struct work_struct *work) { struct ieee80211_local *local = diff --git a/net/mac80211/util.c b/net/mac80211/util.c index 172173b2a9eb8..62c8b4342136e 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c @@ -2313,6 +2313,8 @@ u32 ieee80211_sta_get_rates(struct ieee80211_sub_if_data *sdata, void ieee80211_stop_device(struct ieee80211_local *local) { + ieee80211_handle_queued_frames(local); + ieee80211_led_radio(local, false); ieee80211_mod_tpt_led_trig(local, 0, IEEE80211_TPT_LEDTRIG_FL_RADIO); -- 2.43.0