From patchwork Mon Apr 6 20:19:48 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Malcolm Priestley X-Patchwork-Id: 6165461 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id AD8EEBF4A6 for ; Mon, 6 Apr 2015 20:21:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C87AA20303 for ; Mon, 6 Apr 2015 20:21:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D503E202EC for ; Mon, 6 Apr 2015 20:21:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754180AbbDFUVK (ORCPT ); Mon, 6 Apr 2015 16:21:10 -0400 Received: from mail-wi0-f171.google.com ([209.85.212.171]:34467 "EHLO mail-wi0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754028AbbDFUVH (ORCPT ); Mon, 6 Apr 2015 16:21:07 -0400 Received: by widjs5 with SMTP id js5so525543wid.1 for ; Mon, 06 Apr 2015 13:21:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=RHCqj6fseiUH/RST/EyoHANWOwakhsa0XceFcaj64sg=; b=OnsyyBtYSkbBagSzt2/x6M1tPS14t0vJHETP/1SEbCelsrFdQ/L+CcPnrFTOOE5EIT ztKRzM5OctfXlqmwmUuSAuH3t7+ZFJ4AwCgU02xYrFchYAIBzwH8Fg7YUaCRAE+jzkaQ lBg1V3NYtAgqzCzt1NgOfWB6li3VHCtcFOd9oszr7feDFpvKaEhy+gP7yEN40lvv+Z7z oJGeIDJ0PR5IqisRD6q+vrEIUPBuo4ubIgm4r9cevhSdOdoWzbQWzysYpmiSl4w7y2Nj Gh/txyZwcGP8SQLkBKqLlRt2aoUKqjEU/r7Kj5hxvdeAjlu/G6SmuUamf8qH7FyYlBUa mcUA== X-Received: by 10.194.203.74 with SMTP id ko10mr1686837wjc.96.1428351666314; Mon, 06 Apr 2015 13:21:06 -0700 (PDT) Received: from tipsey.3.home (188.31.6.136.threembb.co.uk. [188.31.6.136]) by mx.google.com with ESMTPSA id pa4sm7852599wjb.11.2015.04.06.13.21.04 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 06 Apr 2015 13:21:05 -0700 (PDT) From: Malcolm Priestley To: gregkh@linuxfoundation.org Cc: linux-wireless@vger.kernel.org, Malcolm Priestley Subject: [PATCH] staging: vt6655: device_intr check for vif on while loop Date: Mon, 6 Apr 2015 21:19:48 +0100 Message-Id: <1428351588-3785-1-git-send-email-tvboxspy@gmail.com> X-Mailer: git-send-email 2.1.0 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_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, 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 vif should never be or go null while in loop. Fixes race condition where interrupts are late and when interface is not present. Signed-off-by: Malcolm Priestley --- drivers/staging/vt6655/device_main.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c index 4bb4f8e..5b3de43 100644 --- a/drivers/staging/vt6655/device_main.c +++ b/drivers/staging/vt6655/device_main.c @@ -1090,7 +1090,7 @@ static irqreturn_t device_intr(int irq, void *dev_instance) * update ISR counter */ STAvUpdate802_11Counter(&pDevice->s802_11Counter, &pDevice->scStatistic, dwMIBCounter); - while (pDevice->dwIsr != 0) { + while (pDevice->dwIsr && pDevice->vif) { STAvUpdateIsrStatCounter(&pDevice->scStatistic, pDevice->dwIsr); MACvWriteISR(pDevice->PortOffset, pDevice->dwIsr); @@ -1102,8 +1102,7 @@ static irqreturn_t device_intr(int irq, void *dev_instance) } if (pDevice->dwIsr & ISR_TBTT) { - if (pDevice->vif && - pDevice->op_mode != NL80211_IFTYPE_ADHOC) + if (pDevice->op_mode != NL80211_IFTYPE_ADHOC) vnt_check_bb_vga(pDevice); pDevice->bBeaconSent = false; @@ -1143,19 +1142,15 @@ static irqreturn_t device_intr(int irq, void *dev_instance) max_count += device_tx_srv(pDevice, TYPE_AC0DMA); if (pDevice->dwIsr & ISR_SOFTTIMER1) { - if (pDevice->vif) { - if (pDevice->vif->bss_conf.enable_beacon) - vnt_beacon_make(pDevice, pDevice->vif); - } + if (pDevice->vif->bss_conf.enable_beacon) + vnt_beacon_make(pDevice, pDevice->vif); } /* If both buffers available wake the queue */ - if (pDevice->vif) { - if (AVAIL_TD(pDevice, TYPE_TXDMA0) && - AVAIL_TD(pDevice, TYPE_AC0DMA) && - ieee80211_queue_stopped(pDevice->hw, 0)) - ieee80211_wake_queues(pDevice->hw); - } + if (AVAIL_TD(pDevice, TYPE_TXDMA0) && + AVAIL_TD(pDevice, TYPE_AC0DMA) && + ieee80211_queue_stopped(pDevice->hw, 0)) + ieee80211_wake_queues(pDevice->hw); MACvReadISR(pDevice->PortOffset, &pDevice->dwIsr);