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=unavailable 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 98E14C04AAF for ; Thu, 16 May 2019 11:42:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 636652087E for ; Thu, 16 May 2019 11:42:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1558006938; bh=eUxnrEwnF6bF+JSc7wVkPo6Dm7nzqZov0fVqkNqdy7Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=VgnUyklKFO0OcUuqn1cNIJ53yxgsvRbMrQ3dj5RxAF9pjsp7sTSB1p+I9wQEWjK3w PX4ZbvdwUv6soQfxz8+37zGz2bH7chfNJ51aXtUL/l3XMIEH4pBqFOZlfQSzcX7V5p c93dVNS+9s5nax3slqULml/CcbwwSvv7lvVEcGs0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728482AbfEPLmI (ORCPT ); Thu, 16 May 2019 07:42:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:50996 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728455AbfEPLmG (ORCPT ); Thu, 16 May 2019 07:42:06 -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 77F362166E; Thu, 16 May 2019 11:42:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1558006925; bh=eUxnrEwnF6bF+JSc7wVkPo6Dm7nzqZov0fVqkNqdy7Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=we+d9JFSXBaaH2Bs+ScBL5zNye7S6Jdr9VeBo6Fidfx8wDHV126mqhrPfWsnDqoeP CughMp+CZo8zyvw26e3wUUD6/r3f9ysnByxJkKasqrThYKOoEbaGvNzST6VBqtmoVZ IDnxXAjP5c7zsCol/q83KERNAf6DXMBzEWDNdV0s= 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 3.18 4/6] mac80211: Fix kernel panic due to use of txq after free Date: Thu, 16 May 2019 07:41:57 -0400 Message-Id: <20190516114159.9382-4-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190516114159.9382-1-sashal@kernel.org> References: <20190516114159.9382-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 f4ce34670fa83..e052c11d8900a 100644 --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c @@ -1764,6 +1764,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