From patchwork Fri May 12 16:42:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Norris X-Patchwork-Id: 9724615 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6A239601E7 for ; Fri, 12 May 2017 16:44:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5752928854 for ; Fri, 12 May 2017 16:44:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4C5512885E; Fri, 12 May 2017 16:44:10 +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=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F11BD28854 for ; Fri, 12 May 2017 16:44:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933247AbdELQmb (ORCPT ); Fri, 12 May 2017 12:42:31 -0400 Received: from mail-pg0-f42.google.com ([74.125.83.42]:33752 "EHLO mail-pg0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933216AbdELQm3 (ORCPT ); Fri, 12 May 2017 12:42:29 -0400 Received: by mail-pg0-f42.google.com with SMTP id u187so32675722pgb.0 for ; Fri, 12 May 2017 09:42:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=l2oSsxWtHzSpZMht4vH1alq2dhnmpYxXgWbjNe4f9/g=; b=URlcug3SQhjbQVIUvPbEyaHQgV8aS0xBMRwDtrmKXj61SZxj9ifORQeS6/LsBGJfzD RMv8av62EgOEu5IycQXXjhcS18jsmj2MagaUPslzY+q1Ue2NBkFk6Fv2eOX30pJEOsb1 vErf3VZHRE8GMEsNgA24bHcRUO/luyp82HbpU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=l2oSsxWtHzSpZMht4vH1alq2dhnmpYxXgWbjNe4f9/g=; b=rFuB/0tjVF8/N0wFL6pzbq46tzvXxQh0wuuFvI2FtAYBY2BJT5UT2uEYCaYfkrO7IR PQHD839gbSb7A78xsyQjsWGJL/iYdU6/ZGjpoPxuOIeyANXTvf1W0klIWj0lZnzELmib 23l7vRWtuqqdtxLDahAZro8VV+UMP9QejVWmSCsr03DEo1Kh1AnAhUqA3G1BiIHTeMEY b/xbngboi7yEdcpUpnrR32tpxrH/DYQnnzO4O2IsLHA5AOIPm7ZJHPSg9fP3JxlOJJgd 9zK2sDYcUjypF3OVhZdR/NPcux/WOeQIpuL98vli2q/+gACycOf0K3ak6TuCVUvGM3O7 9wPQ== X-Gm-Message-State: AODbwcCEzzvs+5VszNczpZLZyIL6JZLyvqsgPJYDiCQ34GvIlXS8HX2L wjENLEK/inf7b1wN X-Received: by 10.99.98.65 with SMTP id w62mr5326633pgb.207.1494607348327; Fri, 12 May 2017 09:42:28 -0700 (PDT) Received: from ban.mtv.corp.google.com ([172.22.64.120]) by smtp.gmail.com with ESMTPSA id u74sm7304499pfk.58.2017.05.12.09.42.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 12 May 2017 09:42:27 -0700 (PDT) From: Brian Norris To: Ganapathi Bhat , Nishant Sarmukadam Cc: , Dmitry Torokhov , Amitkumar Karwar , Kalle Valo , linux-wireless@vger.kernel.org, Doug Anderson , Brian Norris Subject: [PATCH 04/11] mwifiex: Add locking to mwifiex_11n_delba Date: Fri, 12 May 2017 09:42:01 -0700 Message-Id: <20170512164208.38725-4-briannorris@chromium.org> X-Mailer: git-send-email 2.13.0.rc2.291.g57267f2277-goog In-Reply-To: <20170512164208.38725-1-briannorris@chromium.org> References: <20170512164208.38725-1-briannorris@chromium.org> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Douglas Anderson The mwifiex_11n_delba() function walked the rx_reorder_tbl_ptr without holding the lock, which was an obvious violation. Grab the lock. NOTE: we hold the lock while calling mwifiex_send_delba(). There's also several callers in 11n_rxreorder.c that hold the lock and the comments in the struct sound just like very other list/lock pair -- as if the lock should definitely be help for all operations like this. Signed-off-by: Douglas Anderson Signed-off-by: Brian Norris --- drivers/net/wireless/marvell/mwifiex/11n.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/11n.c b/drivers/net/wireless/marvell/mwifiex/11n.c index c75b6abf16a0..16c77c27f1b6 100644 --- a/drivers/net/wireless/marvell/mwifiex/11n.c +++ b/drivers/net/wireless/marvell/mwifiex/11n.c @@ -653,11 +653,13 @@ int mwifiex_send_delba(struct mwifiex_private *priv, int tid, u8 *peer_mac, void mwifiex_11n_delba(struct mwifiex_private *priv, int tid) { struct mwifiex_rx_reorder_tbl *rx_reor_tbl_ptr; + unsigned long flags; + spin_lock_irqsave(&priv->rx_reorder_tbl_lock, flags); if (list_empty(&priv->rx_reorder_tbl_ptr)) { dev_dbg(priv->adapter->dev, "mwifiex_11n_delba: rx_reorder_tbl_ptr empty\n"); - return; + goto exit; } list_for_each_entry(rx_reor_tbl_ptr, &priv->rx_reorder_tbl_ptr, list) { @@ -666,9 +668,11 @@ void mwifiex_11n_delba(struct mwifiex_private *priv, int tid) "Send delba to tid=%d, %pM\n", tid, rx_reor_tbl_ptr->ta); mwifiex_send_delba(priv, tid, rx_reor_tbl_ptr->ta, 0); - return; + goto exit; } } +exit: + spin_unlock_irqrestore(&priv->rx_reorder_tbl_lock, flags); } /*