From patchwork Thu Jan 21 13:23:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Kazior X-Patchwork-Id: 8081081 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 2C2A59F1CC for ; Thu, 21 Jan 2016 13:22:05 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5C8D820461 for ; Thu, 21 Jan 2016 13:22:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2B62420445 for ; Thu, 21 Jan 2016 13:22:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965107AbcAUNWB (ORCPT ); Thu, 21 Jan 2016 08:22:01 -0500 Received: from mail-lb0-f174.google.com ([209.85.217.174]:34808 "EHLO mail-lb0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759002AbcAUNWA (ORCPT ); Thu, 21 Jan 2016 08:22:00 -0500 Received: by mail-lb0-f174.google.com with SMTP id cl12so23080537lbc.1 for ; Thu, 21 Jan 2016 05:21:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tieto.com; s=google; h=from:to:cc:subject:date:message-id; bh=WS5UaO6MJAUAgWuW7ctXFmAc8jVNgNkccwGtGGf3EXQ=; b=3t5GoDjCpyHFmj6qDmhXzrADWQg0meWIwTqUUojWSSguHMQ0wroy9O5ZQ0FdpduNyO IBvLXSRpiiuCxJTfIMT3NyxnCJxImE5nF0vu5bn+aZ45HwnagtQoQj3nv4eF17pNTmuA sjh9Iz9m0mtyQ5Uaysd0vNNWCQJz6ABhHcsjs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=WS5UaO6MJAUAgWuW7ctXFmAc8jVNgNkccwGtGGf3EXQ=; b=AMtRUa9FiQdxuqCcVlSpKJPDHqjSYHfxVWlr4L3AXH9knL9ijM1tqBV/pJR5b82Qbk xLNZdJ4vNsSkFMOAKLnMROv5dJqFnrkI0exErm0e2hNAIN59i1ZC2LI9xt324yzRe3wM ZGkmaHNEE5Hmt1hvd5MNGsYxcWBf4YEanxjst6F1YrNc5SJxH//WuneQmJKLoSfPZR3z RhmzFDOEAsn+nlbZIkfMKN5HNvjpp0JQzfywY0fvL6QPkvCYgMWgJSsOp743ATsiEUnL i5GxW/iu2+lu/ZufiX3yWytUPZjsoQBlYzMYVp9+Em8SjLSyYs4Cln9UDUSpFMz5q2+B NB9w== X-Gm-Message-State: ALoCoQmIkOGjgKOHZzXx0q4exfRim31W0ydtthmhXiIU9z5lx5bg6oga27fHUVXhJJ9LvtrEiyosyzffBiCJb2bkxjYnYZ8u3P2jgfw8igriNKj900NpIGMiIGosHeSr/LRhrI6nP36fzkOsjzgJP2tN/oedCFkWxdU61lwBtmKMJJrI4eVYklUs/DZ98aFie1TsiuhDlFrdBbLQ/O/j2/Nh9Qi8HpaMYQ== X-Received: by 10.112.131.105 with SMTP id ol9mr15524520lbb.45.1453382518649; Thu, 21 Jan 2016 05:21:58 -0800 (PST) Received: from localhost.localdomain ([91.198.246.10]) by smtp.gmail.com with ESMTPSA id d18sm195087lfb.1.2016.01.21.05.21.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 21 Jan 2016 05:21:57 -0800 (PST) From: Michal Kazior To: linux-wireless@vger.kernel.org Cc: johannes@sipsolutions.net, Michal Kazior Subject: [PATCH 1/2] mac80211: fix txq queue related crashes Date: Thu, 21 Jan 2016 14:23:07 +0100 Message-Id: <1453382588-27105-1-git-send-email-michal.kazior@tieto.com> X-Mailer: git-send-email 2.1.4 X-DomainID: tieto.com Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The driver can access the queue simultanously while mac80211 tears down the interface. Without spinlock protection this could lead to corrupting sk_buff_head and subsequently to an invalid pointer dereference. Fixes: ba8c3d6f16a1 ("mac80211: add an intermediate software queue implementation") Signed-off-by: Michal Kazior --- net/mac80211/iface.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c index 33ae3c81bfc5..0451f120746e 100644 --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c @@ -977,7 +977,10 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, if (sdata->vif.txq) { struct txq_info *txqi = to_txq_info(sdata->vif.txq); + spin_lock_bh(&txqi->queue.lock); ieee80211_purge_tx_queue(&local->hw, &txqi->queue); + spin_unlock_bh(&txqi->queue.lock); + atomic_set(&sdata->txqs_len[txqi->txq.ac], 0); }