From patchwork Tue Apr 16 07:24:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bhagavathi Perumal S X-Patchwork-Id: 10902083 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DFC281669 for ; Tue, 16 Apr 2019 07:25:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BD9E628896 for ; Tue, 16 Apr 2019 07:25:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B17D928899; Tue, 16 Apr 2019 07:25:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6ACA928896 for ; Tue, 16 Apr 2019 07:25:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=PZgAg5tqPVxVV53FhfoeZR+4mhLCutP9I6Ye1Nm7qOk=; b=moj rE3aMDWV1K8B6nOHsUD0bSK6gDdPQqrtesc196XE+KgFI9vQFMLmFrSP3tzDTD+rO9GsVsVVjClmf 62d9iF+CxPcejLr/1v6b2UBobCMCrUeift+2rfibI4SwXS7QWP+IWljpyLXZovwXlWIh0KtOzN+bt raRAMLPEInChG2AwNPPAj2tTe5t/KuDwd/0ma5HfL7tg+GsX0mDBlKg2TGgaNwGSbgZ3ezN7S0y7L XNfkVr937Jb+1iy+cp78kguES2p3zqupig5eSV6bXziadXKSMeCUFPhEOK/U5yH4Tu3XEyr4WsLTP /OUgSnrW5boj2vtH1dZa4m7DfzXNK7g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hGISs-0008GK-Jt; Tue, 16 Apr 2019 07:25:10 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hGISq-00081B-4O for ath10k@lists.infradead.org; Tue, 16 Apr 2019 07:25:09 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 6A2A261197; Tue, 16 Apr 2019 07:25:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1555399507; bh=b84iQHmq3pLgs/0fPPCrO4wYwRqB4mvcFrRYcZWOtaM=; h=From:To:Cc:Subject:Date:From; b=i8USXuHtk+NZUiHIcWvrBh3yaiizqxa1S8lJwnM8AB4sR7+916wmRJ0rAQurPJtts TBigdcai4UKeWvtggT86YUE/wGZBTTv8tsBkOW8IYny/MRsWlHje0PAOSX8FL6lpOC YtUSKRXpLGTz4q4ymMsxdAZE6v6pYDJJbHHLVsbk= Received: from localhost (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: bperumal@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 2263560D0C; Tue, 16 Apr 2019 07:25:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1555399506; bh=b84iQHmq3pLgs/0fPPCrO4wYwRqB4mvcFrRYcZWOtaM=; h=From:To:Cc:Subject:Date:From; b=BPJ1VBL17APOj2qQXyGQTf0NvIboL3jNnLZ0FFB52co1BsseX1jkM/WckY/Mt74E0 NvNfN6nriLuC7VLCX+cY3UZT2BXp1QE1d1kyzuz0BN6fb8l1KbABe3KxAbrWFQRC2U vAbM+YGHi7K96LlM8vFNOqW4rsBRaj/y+RXi8sbI= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 2263560D0C Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=bperumal@codeaurora.org From: Bhagavathi Perumal S To: johannes@sipsolutions.net, ath10k@lists.infradead.org, linux-wireless@vger.kernel.org Subject: [PATCH] mac80211: Fix kernel panic due to use of txq after free Date: Tue, 16 Apr 2019 12:54:40 +0530 Message-Id: <1555399480-30537-1-git-send-email-bperumal@codeaurora.org> X-Mailer: git-send-email 1.9.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190416_002508_199056_8C16B319 X-CRM114-Status: UNSURE ( 8.24 ) X-CRM114-Notice: Please train this message. X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bhagavathi Perumal S MIME-Version: 1.0 Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- net/mac80211/iface.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c index 94459b2..410685d 100644 --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c @@ -1907,6 +1907,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) {