From patchwork Fri Jul 11 00:01:38 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eliad Peller X-Patchwork-Id: 4529051 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.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 39BBABEEAA for ; Fri, 11 Jul 2014 00:02:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 771FB201C0 for ; Fri, 11 Jul 2014 00:02:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A6C3D2015E for ; Fri, 11 Jul 2014 00:02:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751795AbaGKACd (ORCPT ); Thu, 10 Jul 2014 20:02:33 -0400 Received: from mail-we0-f178.google.com ([74.125.82.178]:45509 "EHLO mail-we0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751527AbaGKACd (ORCPT ); Thu, 10 Jul 2014 20:02:33 -0400 Received: by mail-we0-f178.google.com with SMTP id x48so285837wes.9 for ; Thu, 10 Jul 2014 17:02:31 -0700 (PDT) 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:in-reply-to :references; bh=ZWrfUzibjdOBQpWYolHbdWQ/YBmKEwnLaENNX/nOqM0=; b=KG4ujFTLJEw3NkWVAAvuk+kCNYVxIHADbwrkirLlJibC48omgmbLfTIZPDlhenzclI TMx26AqqnXp42ylZv3u02cMDDeNCvmj/agwauq7dNDOzbeJfgH0RMaQhKi617EPsS1vW 35rEwQDdQFiiVOEF4qnqt/21Gupd7sWAipW8OYjnhKkNHkwlJQks6dmGOxZflhKNZ2eU jE71ioyHOY3XBtRjtOwKigwZ0O08xmldCPWKHqrAEhVFAIcz9OZfR9eluDrH5zO+pHN4 gBmuOdW8ENFy/aIlvXwehJw5NM+s0rV7fTydx7WVqQfLSrY3lJAMrRYIfpBKyHDGpV5q hCKg== X-Gm-Message-State: ALoCoQlbJyBppLaQLjkkSqQmWIQ3U/fCkN0Xua0trf6r7yTU6W/wnYroz00NfzxR98nSOowd2HuM X-Received: by 10.180.89.193 with SMTP id bq1mr71927wib.81.1405036951236; Thu, 10 Jul 2014 17:02:31 -0700 (PDT) Received: from localhost.localdomain (46-116-157-102.bb.netvision.net.il. [46.116.157.102]) by mx.google.com with ESMTPSA id 19sm1426848wjz.3.2014.07.10.17.02.28 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 10 Jul 2014 17:02:30 -0700 (PDT) From: Eliad Peller To: "John W. Linville" Cc: Subject: [PATCH 13/14] wl18xx: make sure fw_status->priv exists before deref Date: Fri, 11 Jul 2014 03:01:38 +0300 Message-Id: <1405036899-27396-14-git-send-email-eliad@wizery.com> X-Mailer: git-send-email 1.8.5.1.109.g3d252a9 In-Reply-To: <1405036899-27396-1-git-send-email-eliad@wizery.com> References: <1405036899-27396-1-git-send-email-eliad@wizery.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=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 In some corner cases with specific timings, we might try dequeueing tx before we got information about the link status (e.g. due to recovery during tx). Instead of NULL dereference, assume all the links in this case have low priorities. Signed-off-by: Eliad Peller --- drivers/net/wireless/ti/wl18xx/main.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ti/wl18xx/main.c b/drivers/net/wireless/ti/wl18xx/main.c index 4422ecf..edc3e4d 100644 --- a/drivers/net/wireless/ti/wl18xx/main.c +++ b/drivers/net/wireless/ti/wl18xx/main.c @@ -1609,9 +1609,14 @@ static bool wl18xx_lnk_high_prio(struct wl1271 *wl, u8 hlid, u8 thold; struct wl18xx_fw_status_priv *status_priv = (struct wl18xx_fw_status_priv *)wl->fw_status->priv; - u32 suspend_bitmap = le32_to_cpu(status_priv->link_suspend_bitmap); + u32 suspend_bitmap; + + /* if we don't have the link map yet, assume they all low prio */ + if (!status_priv) + return false; /* suspended links are never high priority */ + suspend_bitmap = le32_to_cpu(status_priv->link_suspend_bitmap); if (test_bit(hlid, (unsigned long *)&suspend_bitmap)) return false; @@ -1631,8 +1636,13 @@ static bool wl18xx_lnk_low_prio(struct wl1271 *wl, u8 hlid, u8 thold; struct wl18xx_fw_status_priv *status_priv = (struct wl18xx_fw_status_priv *)wl->fw_status->priv; - u32 suspend_bitmap = le32_to_cpu(status_priv->link_suspend_bitmap); + u32 suspend_bitmap; + + /* if we don't have the link map yet, assume they all low prio */ + if (!status_priv) + return true; + suspend_bitmap = le32_to_cpu(status_priv->link_suspend_bitmap); if (test_bit(hlid, (unsigned long *)&suspend_bitmap)) thold = status_priv->tx_suspend_threshold; else if (test_bit(hlid, (unsigned long *)&wl->fw_fast_lnk_map) &&