From patchwork Sun Jan 25 08:52:51 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Kondratiev X-Patchwork-Id: 5700851 X-Patchwork-Delegate: kvalo@adurom.com 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 4A1289F2ED for ; Sun, 25 Jan 2015 08:53:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7135820155 for ; Sun, 25 Jan 2015 08:53:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7A52120131 for ; Sun, 25 Jan 2015 08:53:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752754AbbAYIxq (ORCPT ); Sun, 25 Jan 2015 03:53:46 -0500 Received: from wolverine02.qualcomm.com ([199.106.114.251]:31610 "EHLO wolverine02.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752718AbbAYIxl (ORCPT ); Sun, 25 Jan 2015 03:53:41 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=qca.qualcomm.com; i=@qca.qualcomm.com; q=dns/txt; s=qcdkim; t=1422176021; x=1453712021; h=from:cc:to:subject:date:message-id:in-reply-to: references; bh=KYEtJNlnegqzWZpXF+pF5sgwEcUzM2wi+fBnaiHkzjE=; b=rmrOTA8tt/vA8LHiI99JphieadoL5dTPOnbj4WDHNU7pro7G7/DQNJa2 iIG1XCA8pIRMNglTo2r81cjPzbuajfyK+cEJRWUFsKIscTgEVju2z6uNz UeJTuDlPHS6c7r1O1Bnj2L7cF4XZquScVONnvmdf7erDu96ZdrLGR7wuH Y=; X-IronPort-AV: E=McAfee;i="5600,1067,7691"; a="191850684" Received: from ironmsg02-r.qualcomm.com ([172.30.46.16]) by wolverine02.qualcomm.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 25 Jan 2015 00:53:41 -0800 From: Vladimir Kondratiev Cc: Vladimir Kondratiev , linux-wireless@vger.kernel.org, wil6210@qca.qualcomm.com X-IronPort-AV: E=Sophos;i="5.09,463,1418112000"; d="scan'208";a="431455932" Received: from lx-wigig-72.mea.qualcomm.com ([10.18.176.26]) by ironmsg02-R.qualcomm.com with ESMTP; 25 Jan 2015 00:53:41 -0800 To: Kalle Valo Subject: [PATCH 10/10] wil6210: move Rx reorder buffer allocation out of spinlock Date: Sun, 25 Jan 2015 10:52:51 +0200 Message-Id: <1422175971-8075-11-git-send-email-qca_vkondrat@qca.qualcomm.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1422175971-8075-1-git-send-email-qca_vkondrat@qca.qualcomm.com> References: <1422175971-8075-1-git-send-email-qca_vkondrat@qca.qualcomm.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=-5.8 required=5.0 tests=BAYES_00,BIGNUM_EMAILS, DKIM_SIGNED,RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 This fixes issue reported by Dan Carpenter: The patch 3277213feb1b: "wil6210: ADDBA/DELBA flows" from Dec 23, 2014, leads to the following static checker warning: drivers/net/wireless/ath/wil6210/rx_reorder.c:205 wil_tid_ampdu_rx_alloc() error: scheduling with locks held: 'spin_lock:tid_rx_lock' drivers/net/wireless/ath/wil6210/rx_reorder.c 202 struct wil_tid_ampdu_rx *wil_tid_ampdu_rx_alloc(struct wil6210_priv *wil, 203 int size, u16 ssn) 204 { 205 struct wil_tid_ampdu_rx *r = kzalloc(sizeof(*r), GFP_KERNEL); ^^^^^^^^^^ 206 207 if (!r) 208 return NULL; 209 210 r->reorder_buf = 211 kcalloc(size, sizeof(struct sk_buff *), GFP_KERNEL); ^^^^^^^^^^^ 212 r->reorder_time = 213 kcalloc(size, sizeof(unsigned long), GFP_KERNEL); ^^^^^^^^^^^ 214 if (!r->reorder_buf || !r->reorder_time) { 215 kfree(r->reorder_buf); 216 kfree(r->reorder_time); 217 kfree(r); 218 return NULL; 219 } 220 [ snip ] 331 spin_lock_bh(&sta->tid_rx_lock); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ spin lock held. 332 333 wil_tid_ampdu_rx_free(wil, sta->tid_rx[tid]); 334 sta->tid_rx[tid] = wil_tid_ampdu_rx_alloc(wil, agg_wsize, ssn); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function called with the lock held. 335 336 spin_unlock_bh(&sta->tid_rx_lock); Reported-by: Dan Carpenter Signed-off-by: Vladimir Kondratiev --- drivers/net/wireless/ath/wil6210/rx_reorder.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/ath/wil6210/rx_reorder.c b/drivers/net/wireless/ath/wil6210/rx_reorder.c index 5522092..ca10dcf 100644 --- a/drivers/net/wireless/ath/wil6210/rx_reorder.c +++ b/drivers/net/wireless/ath/wil6210/rx_reorder.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Qualcomm Atheros, Inc. + * Copyright (c) 2014-2015 Qualcomm Atheros, Inc. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -292,6 +292,7 @@ __acquires(&sta->tid_rx_lock) __releases(&sta->tid_rx_lock) u16 agg_timeout = req->ba_timeout; u16 status = WLAN_STATUS_SUCCESS; u16 ssn = req->ba_seq_ctrl >> 4; + struct wil_tid_ampdu_rx *r; int rc; might_sleep(); @@ -328,11 +329,10 @@ __acquires(&sta->tid_rx_lock) __releases(&sta->tid_rx_lock) return; /* apply */ + r = wil_tid_ampdu_rx_alloc(wil, agg_wsize, ssn); spin_lock_bh(&sta->tid_rx_lock); - wil_tid_ampdu_rx_free(wil, sta->tid_rx[tid]); - sta->tid_rx[tid] = wil_tid_ampdu_rx_alloc(wil, agg_wsize, ssn); - + sta->tid_rx[tid] = r; spin_unlock_bh(&sta->tid_rx_lock); }