From patchwork Tue Jul 11 01:33:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Larry Finger X-Patchwork-Id: 9833895 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 D50E860363 for ; Tue, 11 Jul 2017 01:33:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D8ED523B32 for ; Tue, 11 Jul 2017 01:33:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CD5D22853B; Tue, 11 Jul 2017 01:33:36 +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=-6.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham 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 6DB1823B32 for ; Tue, 11 Jul 2017 01:33:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754869AbdGKBde (ORCPT ); Mon, 10 Jul 2017 21:33:34 -0400 Received: from mail-oi0-f68.google.com ([209.85.218.68]:36295 "EHLO mail-oi0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754644AbdGKBdc (ORCPT ); Mon, 10 Jul 2017 21:33:32 -0400 Received: by mail-oi0-f68.google.com with SMTP id n2so13919295oig.3; Mon, 10 Jul 2017 18:33:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=9nB0v+bRB9eZ55mUv2ug6yCcj7ILWk1qlkWnW5lhfo8=; b=DESUoSnt2EIz7foOY6V37X3Mwo1IGjmy5K7geKRvA4eP+BaJzTXnj41cZRuD8OKcfJ xob9zXyCHyK8WsOqM6qWgCEVIOohCTvqHX8oLfCC/R+8HCXj/p/KXZDaayt7f94NjqbV 3nzCtlQCw+dAdXy0R0bw9yt+nRZa4tcd8TEk2uQTGM1Dfw8dlFYk3NtPrOXLM+rGEimc FktWmpd6TM7zrL3qjax/utot3lkAomyL6JCROE/N0sybpVrSrq2R7L9zYi2r9wKP0Daq GgbT22/Uz9OlWMOAaH21sK8zpI7kbaMDZ3BRfZN50umwoy1afkxDP97WdtFWCG0H9PHz rPNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=9nB0v+bRB9eZ55mUv2ug6yCcj7ILWk1qlkWnW5lhfo8=; b=Hqd1EF4ix0yrENQl1HF2nBBWVRi9nGEKn6Yr6CWJuYnmjHCAsjTDSdJGUZmcnkxaZT jbrwqfrmykmBP8mjMR+c2CtVvXU7gPaB5c2p2qvq17bHiMlXUDMCSydETBwlUzbL96sL ni7yUFF2X8iShgtnNPw7aq5MuY+Ur1KAG5wCW10IaQYeveN/deLMbSVO68E5EK5uY565 Zwc0YKa75SaJT9W0Q0WVAUu4uXnL+13QH4SW77huwT8aIMAB/PxmNBw4UZQR06zUS5HV 6z6GAFYiyTC5G8ptMqdHRYSRfuB2LPhbfz+J7hZhjd/pIMP+h/zr70x7vHhMwkkhddSh ji9g== X-Gm-Message-State: AIVw111xzcnrutFYgK32N6B9yBzxyqaa49yZRWodNIk81yWvS+DkRC92 iAPk9PDZkHsUjg== X-Received: by 10.202.78.15 with SMTP id c15mr12632068oib.203.1499736812095; Mon, 10 Jul 2017 18:33:32 -0700 (PDT) Received: from linux-4v1g.suse (cpe-24-31-249-175.kc.res.rr.com. [24.31.249.175]) by smtp.gmail.com with ESMTPSA id t77sm20514221oif.38.2017.07.10.18.33.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 10 Jul 2017 18:33:31 -0700 (PDT) From: Larry Finger To: kvalo@codeaurora.org Cc: linux-wireless@vger.kernel.org, Ping-Ke Shih , Stable , Larry Finger Subject: [PATCH 2/2] rtlwifi: fix static checker warning of dereferencing freed memory Date: Mon, 10 Jul 2017 20:33:13 -0500 Message-Id: <20170711013313.3478-3-Larry.Finger@lwfinger.net> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20170711013313.3478-1-Larry.Finger@lwfinger.net> References: <20170711013313.3478-1-Larry.Finger@lwfinger.net> 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: Ping-Ke Shih Patch c76ab8e75442 ("rtlwifi: Fill ap_num field by driver") leads to the following static checker warning: drivers/net/wireless/realtek/rtlwifi/base.c:1741 rtl_scan_list_expire() error: dereferencing freed memory 'entry' Reported-by: Dan Carpenter Fixes: c76ab8e75442 ("rtlwifi: Fill ap_num field by driver") Cc: Stable # 4.12+ Signed-off-by: Ping-Ke Shih Signed-off-by: Larry Finger --- drivers/net/wireless/realtek/rtlwifi/base.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/realtek/rtlwifi/base.c b/drivers/net/wireless/realtek/rtlwifi/base.c index d7a1e2d2d529..7074aee35a11 100644 --- a/drivers/net/wireless/realtek/rtlwifi/base.c +++ b/drivers/net/wireless/realtek/rtlwifi/base.c @@ -1805,13 +1805,13 @@ void rtl_scan_list_expire(struct ieee80211_hw *hw) if (jiffies_to_msecs(jiffies - entry->age) < 180000) continue; + RT_TRACE(rtlpriv, COMP_SCAN, DBG_LOUD, + "BSSID=%pM is expire in scan list (total=%d)\n", + entry->bssid, rtlpriv->scan_list.num - 1); + list_del(&entry->list); kfree(entry); rtlpriv->scan_list.num--; - - RT_TRACE(rtlpriv, COMP_SCAN, DBG_LOUD, - "BSSID=%pM is expire in scan list (total=%d)\n", - entry->bssid, rtlpriv->scan_list.num); } spin_unlock_irqrestore(&rtlpriv->locks.scan_list_lock, flags);