From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AB3CAC04AAF for ; Thu, 16 May 2019 11:41:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 749A520881 for ; Thu, 16 May 2019 11:41:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1558006905; bh=8eARBYmvj/PR+Vmhg1+Mrnms2xkYXMN8hkHgcDObopo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=qngvQG1pE88W/acB58QNnkWStYRm7XvSgU8vrF11EnTKGQxAiLtrqwOIwaq0uBl1t uMlZzcNZtXuX60loJCeAJAQJH7PFY8V61LoC2rrxS/zV3kkyvA/7f0odbapaPsUFle +G05PgrGX+oGZdAW59PVKwthS7iKYHmwer+wo1Tk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728308AbfEPLlo (ORCPT ); Thu, 16 May 2019 07:41:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:50432 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728279AbfEPLll (ORCPT ); Thu, 16 May 2019 07:41:41 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B70F52089E; Thu, 16 May 2019 11:41:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1558006900; bh=8eARBYmvj/PR+Vmhg1+Mrnms2xkYXMN8hkHgcDObopo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lIadVS4mwnMSPf7KYrK2NKYx+sZa3HkwiaZqt165prUzH0oqJFTNES3WkpBax351y mTjpo2cjtXWYzntkRxBwEJNiOFfw7fxwOHQco0MzwtzQtlUGfgrZcEtAXKXEdVh+x4 y3klnUUgdA7M6su1ZAcZDNq+sdifKCrTKPtpzQtY= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Bhagavathi Perumal S , =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= , Johannes Berg , Sasha Levin , linux-wireless@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH AUTOSEL 4.9 5/9] mac80211: Fix kernel panic due to use of txq after free Date: Thu, 16 May 2019 07:41:29 -0400 Message-Id: <20190516114134.9146-5-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190516114134.9146-1-sashal@kernel.org> References: <20190516114134.9146-1-sashal@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Bhagavathi Perumal S [ Upstream commit f1267cf3c01b12e0f843fb6a7450a7f0b2efab8a ] The txq of vif is added to active_txqs list for ATF TXQ scheduling in the function ieee80211_queue_skb(), but it was not properly removed before freeing the txq object. It was causing use after free of the txq objects from the active_txqs list, result was kernel panic due to invalid memory access. Fix kernel invalid memory access by properly removing txq object from active_txqs list before free the object. Signed-off-by: Bhagavathi Perumal S Acked-by: Toke Høiland-Jørgensen Signed-off-by: Johannes Berg Signed-off-by: Sasha Levin --- net/mac80211/iface.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c index 5768560cbfc3e..ad03331ee7855 100644 --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c @@ -1937,6 +1937,9 @@ void ieee80211_if_remove(struct ieee80211_sub_if_data *sdata) list_del_rcu(&sdata->list); mutex_unlock(&sdata->local->iflist_mtx); + if (sdata->vif.txq) + ieee80211_txq_purge(sdata->local, to_txq_info(sdata->vif.txq)); + synchronize_rcu(); if (sdata->dev) { -- 2.20.1