Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp3072412rdb; Tue, 13 Feb 2024 06:13:48 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCU+T2aofVKNuSoQ2UP7qqHCqJq9UCYfBEjfTjFo70W3A5NAgc+xEw771ZRHCazC4EwI9DTcFZBWYiVH4p5YAz0JIP3AjP8ijeZORsx7kQ== X-Google-Smtp-Source: AGHT+IGCdK75CjxShRqUUsYlThJcDWEiDUMW8dWY28UfjQeANuv8djbij6jNVc+y1QFmUHFskysh X-Received: by 2002:a17:903:190:b0:1d9:ec0a:52b4 with SMTP id z16-20020a170903019000b001d9ec0a52b4mr4199729plg.21.1707833627989; Tue, 13 Feb 2024 06:13:47 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707833627; cv=pass; d=google.com; s=arc-20160816; b=bARX1zR/hhZp1Neqw2kIX4/7J2xYBiNrxZB1kN8PGhkfxYYBD+cwTHkg/7UO2G+BD4 DlYF+2ibutGk+4ksqTwyGx2fZV4b3dC2a0h8BpJOM4HMEoaSn+7+cGak3QjlwXnAW7i0 /1EqBxSYv4s+UfwPCWnjSTy0B4mKkFjSyWogSSGGStTwMUkGvCfafzBJkiw1bPBFdL0j dAzV9EKNOK2x6quXLfStnKvbkqI/dkwwf4DR/S95Sk9nL2+Clz3Denn1CRJVJ0eUayfF 2cM9ZFXhl4A+1KbMHpKpOgLAdrsA+uNvFruTxZ8SkmWwJOJG3u5Sc5lJE+Jqzf7KAy9J pijA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:content-language:in-reply-to:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:user-agent:date :message-id:organization:from:references:to:subject:dkim-signature :dkim-filter; bh=9Nj9sjqANxYXCENPqC9XmDDVQt+CEh+fwvzjl7BD2M0=; fh=aQD5DOswigwYJtGO7/MkNk+nqdFU0+jeSkeYELwW9r4=; b=YXVMjDFxEsJtd0xlWBL2y/t3MRrh2ux/wVIJn9wHMYZjxcAxIXX+havhWt5FB6tK0L mU6RqG8zPDtB+Oa9bNw8y6XxzyKyyuiRJxw5ksT6fq7XO2YJXKdoXE1Ii59wNw2oDo0W HW9ZOoxiSVPEgetP79MmMtO7WAI1lx0M1l6YwPqdJBFJah2xvrrozypJC4XnQFpLEgwx yL3+gVezJNe4wRLcUJxuidrl3Ug3rjhOJxC0zZRm8YAVgEL7xXdDNPKYxJqcE7JouqhW ++B1bhEqY3P7zmipysjkZTq+Vio9yKSDvvAj7aU8iwgc6LUQ6FnoUQdTe0/G4gGPWtfr 8zqg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@candelatech.com header.s=default header.b=DX8XQVkP; arc=pass (i=1 spf=pass spfdomain=candelatech.com dkim=pass dkdomain=candelatech.com dmarc=pass fromdomain=candelatech.com); spf=pass (google.com: domain of linux-wireless+bounces-3544-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-3544-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=candelatech.com X-Forwarded-Encrypted: i=2; AJvYcCW4tl8niY73LkNzPbkI3hCfbuFkxXV2mSYguQlYAuWCx4QYXAZN2McawLcQzwV9+fyI51L6DchbuqXFksCU5fQSyMhFJe5e0gAQhcRYnQ== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id mc7-20020a1709032b0700b001da1e84c2fbsi2082535plb.9.2024.02.13.06.13.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 06:13:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-3544-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@candelatech.com header.s=default header.b=DX8XQVkP; arc=pass (i=1 spf=pass spfdomain=candelatech.com dkim=pass dkdomain=candelatech.com dmarc=pass fromdomain=candelatech.com); spf=pass (google.com: domain of linux-wireless+bounces-3544-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-3544-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=candelatech.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id A022A281DE6 for ; Tue, 13 Feb 2024 14:13:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4A5A85786C; Tue, 13 Feb 2024 14:13:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=candelatech.com header.i=@candelatech.com header.b="DX8XQVkP" X-Original-To: linux-wireless@vger.kernel.org Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [67.231.154.184]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2DC5857866 for ; Tue, 13 Feb 2024 14:13:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=67.231.154.184 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707833627; cv=none; b=S9j9UdrZndCy+lgd83hE6dQxdzhRepQ7/ZgD3iq+39/5JtD8Vofx3jE+9EQVhXX0WiEjWBx0pZr+1Zle82dcv8LFa0FmilXcj3hYFS4Id3+7eRutcmBXIYwTo5KLXWPOrSyInpIiw6GyDTsKJ7cfV5e5H8H4Xs0y+eMAWN86EDY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707833627; c=relaxed/simple; bh=iZ1RYsiUccQ7lkkZjla8su2Ot/G1lA/mWZS2JHQmuC4=; h=Subject:To:References:From:Message-ID:Date:MIME-Version: In-Reply-To:Content-Type; b=i3R0Cb+ItEMH60VgmCd1UqArhipwAOTeiRFy0duf1BitkyrKQK2Nade0fNfHS3B3fA+7nSiehxdldq40+gtcJGXXwPBEuoTKXP+7nE0lZCsnK8r9uCJP/ENipQgiVbLwk3wGMCVprBLNTt7w02fCTwsMRMBAFolG9DmmaPnfnb4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=candelatech.com; spf=pass smtp.mailfrom=candelatech.com; dkim=pass (1024-bit key) header.d=candelatech.com header.i=@candelatech.com header.b=DX8XQVkP; arc=none smtp.client-ip=67.231.154.184 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=candelatech.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=candelatech.com X-Virus-Scanned: Proofpoint Essentials engine Received: from mail3.candelatech.com (mail2.candelatech.com [208.74.158.173]) by mx1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTP id 2D1CF8C0077; Tue, 13 Feb 2024 14:13:41 +0000 (UTC) Received: from [192.168.1.115] (unknown [98.97.116.226]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail3.candelatech.com (Postfix) with ESMTPSA id 240E513C2B0; Tue, 13 Feb 2024 06:13:40 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 mail3.candelatech.com 240E513C2B0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=candelatech.com; s=default; t=1707833620; bh=iZ1RYsiUccQ7lkkZjla8su2Ot/G1lA/mWZS2JHQmuC4=; h=Subject:To:References:From:Date:In-Reply-To:From; b=DX8XQVkPN2yHcJmxa54pjBInXmglQJiCMPJ2cdFlOO2ziKpvHUX+173b60nf2e9a3 1n/+qn7aFN4KaftdWzrGUrF8FfXYRxG1cA05+Om+V1yLXJbQH6zqAAJgcF/s4EDxWa tvadWigQ0UjgN10n6IGizSz64XJpPt8ATQ0KbELc= Subject: Re: iwlwifi RFC related to iwl_mvm_tx_reclaim To: Johannes Berg , linux-wireless References: <9779efb62cec04926e3bb2575a8aecc8bbf0e7ff.camel@sipsolutions.net> From: Ben Greear Organization: Candela Technologies Message-ID: <2839f687-88af-ecd8-c6cb-7bdaf1808496@candelatech.com> Date: Tue, 13 Feb 2024 06:13:39 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In-Reply-To: <9779efb62cec04926e3bb2575a8aecc8bbf0e7ff.camel@sipsolutions.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-MW Content-Transfer-Encoding: 7bit X-MDID: 1707833623-tbED2PLO3mbx X-MDID-O: us5;at1;1707833623;tbED2PLO3mbx;;b42792dba290a1257c3f0aaf1c60b0ff On 2/13/24 1:37 AM, Johannes Berg wrote: > On Mon, 2024-02-12 at 15:22 -0800, Ben Greear wrote: >> I'm seeing a crash due to accessing an 'sta' object in this method that is '-2' as integer. >> >> It fails the initial check for null STA, but I'm thinking it might should check for IS_ERR(sta) >> as well. >> >> (I have my own patch that references sta before the IS_ERR check later in the code, and this >> causes the crash I'm seeing. I guess upstream will not crash in this situation.). > > Indeed. > >> My question: Is the patch below a preferred approach, or should I add special checks to where I >> access sta and only exit the method lower where it already has the IS_ERR(sta) check? > > You can do whatever you want in your tree, but I guess generally I'd > advocate you assume that the code does what it should ;-) > > In this case, ERR_PTR(-ENOENT) is used to indicate the station is being > deleted, but has not yet been fully removed, and so indeed we still want > to reclaim the frames here correctly, which the code does. > > The comment below even kind of explains that? If sta is NULL, we should still reclaim the frames? If so the check earlier in the code where it returns early if sta is NULL could be deleted, and add a null check down near the IS_ERR check? I can (and have) fixed the bug in my code, I'm trying to understand if the driver itself needs improving here to cover an edge case. Thanks, Ben > > johannes > -- Ben Greear Candela Technologies Inc http://www.candelatech.com