From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1D9A7C433E9 for ; Wed, 17 Feb 2021 14:57:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E2A4464E33 for ; Wed, 17 Feb 2021 14:57:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233643AbhBQO5p (ORCPT ); Wed, 17 Feb 2021 09:57:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233381AbhBQO5h (ORCPT ); Wed, 17 Feb 2021 09:57:37 -0500 Received: from mail-il1-x130.google.com (mail-il1-x130.google.com [IPv6:2607:f8b0:4864:20::130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 52CCDC061756 for ; Wed, 17 Feb 2021 06:56:57 -0800 (PST) Received: by mail-il1-x130.google.com with SMTP id o15so11500300ilt.6 for ; Wed, 17 Feb 2021 06:56:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=ydHdMTd4ps0AXeryEcGbvz8MsZ78eQIQNAjnZKZ5I+Q=; b=QArniZnH1HDN6XbvShuegQf8ATVhoFhQM5Sx7rfRv8KxefFdxWqqxZXVJJRewt1t9B ui/nmcdNhusE232TDbipsbl7LSrJ2CDBYSH+/tbcHgCtWSljTZ8gAKTsF6RvKJJUI3SV Sz1RjjI5qqmQw+u5ReOCNewVDaMRHDst8qXHo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=ydHdMTd4ps0AXeryEcGbvz8MsZ78eQIQNAjnZKZ5I+Q=; b=rl4w2CyfS/sU0nqdHaQWtEHjfdeOaKnLLM6Y6f2YtqJdjUqFzIDebQcI4sJjCBtrGh lc2ZXOWCOSr1TShIjs9xiBUIvw74c/QKTOuV1kITTQgD5nGJNNO6IWyZ4OCZBs2f5Saj 7TQkZ69m8DkGaGKMWo4ATWHpgKXRMFSoY0qNQdqIbIkUfZJFgVGKnSOmHt1NAnthQLjK rtSQiO9xgtvUbWd6IX46bfEwZHSUefpLbX18XIC1zQwjApIpp77Jm1NrmedUmcUR5o4w Y+N7hD9zz17aOpRvRkixW5fSpQI0BfBuP26i4ni3eSLrbzWk1Qb910Rh61310OTSp6b3 ym8g== X-Gm-Message-State: AOAM531Lk6dcJCusHXNVU4cu2hBmCSkjHxLkyYml4DIbgq634IiLf+Pe XsjZOe3GXrNYjYz7Kq85BEMI7Q== X-Google-Smtp-Source: ABdhPJw5y5a0RH3ydxnaC8AND6fqVq95Foh3kAjnn/EOfAMY55LcXRd2zLwX7KDppkSNGv0xtdzQBA== X-Received: by 2002:a92:8557:: with SMTP id f84mr21452757ilh.4.1613573816719; Wed, 17 Feb 2021 06:56:56 -0800 (PST) Received: from [192.168.1.112] (c-24-9-64-241.hsd1.co.comcast.net. [24.9.64.241]) by smtp.gmail.com with ESMTPSA id n23sm1415589iog.3.2021.02.17.06.56.55 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 17 Feb 2021 06:56:56 -0800 (PST) Subject: Re: [PATCH 2/2] ath9k: fix ath_tx_process_buffer() potential null ptr dereference To: Kalle Valo Cc: Felix Fietkau , davem@davemloft.net, kuba@kernel.org, ath9k-devel@qca.qualcomm.com, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Shuah Khan References: <43ed9abb9e8d7112f3cc168c2f8c489e253635ba.1613090339.git.skhan@linuxfoundation.org> <20210216070336.D138BC43463@smtp.codeaurora.org> <0fd9a538-e269-e10e-a7f9-02d4c5848420@nbd.name> <878s7nqhg0.fsf@codeaurora.org> From: Shuah Khan Message-ID: <6bbeb37f-620e-d92d-d042-a507bbb39808@linuxfoundation.org> Date: Wed, 17 Feb 2021 07:56:55 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 MIME-Version: 1.0 In-Reply-To: <878s7nqhg0.fsf@codeaurora.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2/17/21 12:30 AM, Kalle Valo wrote: > Shuah Khan writes: > >> On 2/16/21 12:53 AM, Felix Fietkau wrote: >>> >>> On 2021-02-16 08:03, Kalle Valo wrote: >>>> Shuah Khan wrote: >>>> >>>>> ath_tx_process_buffer() references ieee80211_find_sta_by_ifaddr() >>>>> return pointer (sta) outside null check. Fix it by moving the code >>>>> block under the null check. >>>>> >>>>> This problem was found while reviewing code to debug RCU warn from >>>>> ath10k_wmi_tlv_parse_peer_stats_info() and a subsequent manual audit >>>>> of other callers of ieee80211_find_sta_by_ifaddr() that don't hold >>>>> RCU read lock. >>>>> >>>>> Signed-off-by: Shuah Khan >>>>> Signed-off-by: Kalle Valo >>>> >>>> Patch applied to ath-next branch of ath.git, thanks. >>>> >>>> a56c14bb21b2 ath9k: fix ath_tx_process_buffer() potential null ptr dereference >>> I just took another look at this patch, and it is completely bogus. >>> Not only does the stated reason not make any sense (sta is simply passed >>> to other functions, not dereferenced without checks), but this also >>> introduces a horrible memory leak by skipping buffer completion if sta >>> is NULL. >>> Please drop it, the code is fine as-is. >> >> A comment describing what you said here might be a good addition to this >> comment block though. > > Shuah, can you send a followup patch which reverts your change and adds > the comment? I try to avoid rebasing my trees. > I can do that. thanks, -- Shuah