Received: by 2002:a05:7412:2a91:b0:fc:a2b0:25d7 with SMTP id u17csp752267rdh; Wed, 14 Feb 2024 10:12:27 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXT74tDy9wqY3ev4JTxwdg/d9HGD07SzB1ewEAbP9ux0XgM/tmciHTAgiHW+NMwdvjOFPqoyJjaX8CGsTH+tEOZK5uamDluN1azOSL7DQ== X-Google-Smtp-Source: AGHT+IHwfFTRoFp9Bk9WWGTLmBziNDSWKoyssN+pQqYZBLKNL5NqNeCRcsYkOep99qjshi2i0o2n X-Received: by 2002:aa7:c3c6:0:b0:563:87e8:176 with SMTP id l6-20020aa7c3c6000000b0056387e80176mr1525991edr.12.1707934347102; Wed, 14 Feb 2024 10:12:27 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707934347; cv=pass; d=google.com; s=arc-20160816; b=hV743Kp4b276MhOVuWzLOVDymYSS+pegd04zY+gk06WhfhJ2qAQYYnU4EqAPSgyaAk mVxuFI192XVG8L9RBlM79beSEjPSoq3u6YBxkDxxIke7ZVC2UtoQy1AvyJR8scygalad NW7WfZDM1emMymgV1jjcDkyJtWnXrazCxJYKZ+ok1N0BNgt5JANZ9nIswaMQU4Rjf/lU kEpZEZb8VzW/kC7nnYspFPWahN3RO3VxtHI2MV+KREGWKbrgyXSC279H8HJsR8l8CsQD cZKODu2GKc3LfQSqe8DL4etkaedmhbLTwlLz4lbPNGhGmkoLMYVvcSNq3Xe3DUBIvPbq N+IQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:organization:from:references :to:content-language:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :dkim-signature:dkim-filter; bh=AtSQUAzpyy6vGovwm+TaCQLpzdGMjpKA9Gw7x7eCqhI=; fh=F23w9lM6vRGq7lW28Ezm7a4NChQAN2/SkNm+vkeoijs=; b=QKPWqEJg7Ij8g+ZIIcvZ2raU+DURl+AJmBhSfldtLX5LPnQ4ejtk+rZQZ4hlo8bqkh FrhJCNuY/a4r8FohqquSgXqL0LfmGPOnBKuwCiE812y0v93WsU++amhRdKlZx3xZHPR1 DK6sQyb13G0n1y+TLxXyZX0Mn2Z/+j6LXQG7PkIXKKg2X9RDFjv5q5oKXGJMB6dgVJlw zY4GjfjQq2R/FT9O7DgyZKhFnysidZhQaNlT861zRE4DfZzFdZd0XeAIP2OpHuNtuwgS wCgL/rA5lMzAH0MReTexh6/SbBboajIt5OWyhLb3IT5Sjfxz+oCZLvJ8mT/NJo28ZAGF cchA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@candelatech.com header.s=default header.b=V2P9hVhx; 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-3595-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-wireless+bounces-3595-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; AJvYcCWUh8d+2x4uRzoz4upokYVSOseOGxL+IWLdqGtds9XA6q/5Z/as/OMnvKq+yWNnpY4vQ9y3bqfNMF1eIxzO8btlkL7AbVrOH+6Jv7e6eQ== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id s26-20020a05640217da00b0056383ed3e87si631054edy.198.2024.02.14.10.12.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Feb 2024 10:12:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-3595-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@candelatech.com header.s=default header.b=V2P9hVhx; 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-3595-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-wireless+bounces-3595-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 am.mirrors.kernel.org (Postfix) with ESMTPS id AAA0B1F227BF for ; Wed, 14 Feb 2024 18:12:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 80A0512A142; Wed, 14 Feb 2024 18:09:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=candelatech.com header.i=@candelatech.com header.b="V2P9hVhx" X-Original-To: linux-wireless@vger.kernel.org Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [148.163.129.52]) (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 531051272D7 for ; Wed, 14 Feb 2024 18:09:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.129.52 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707934149; cv=none; b=UOoZYbhbO/QvW22gvYcF/jdXJxWC1dcP3Q3+B6KNRIq7xHH+GDp9VSMDTIUvIlYn3X2JQ4ZAJKmpWlB7Z0O2Gw9jTmpjGlpjRPp7ySzQF8LMR87kPfJK8o+eKWmK+LK4ACql8fDERGikXh70tF8eSnWbRpHVRKIJpcTs6JXgcfo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707934149; c=relaxed/simple; bh=Slk+qe7+wd3UQjJPJZX28GS89SLvGOhwEQPTnKc8Too=; h=Message-ID:Date:MIME-Version:Subject:To:References:From: In-Reply-To:Content-Type; b=qkuoti2mHPMuzzjdZB8+m08yARjz5BgQ62WGVLfN4WKFiBjHmHIEcUrXUz58XlXxGa158CSNHGHSBZG0UjGOKgRgiuns8249fGRfQdD7CFMFgC2MTiE//+1SJ+wxnQP9eTImmyctTwv9Ot5oxL5Z66D4PcQgryIlvfTYXgw4PBc= 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=V2P9hVhx; arc=none smtp.client-ip=148.163.129.52 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 5756FB00082; Wed, 14 Feb 2024 18:08:59 +0000 (UTC) Received: from [192.168.100.159] (unknown [50.251.239.81]) (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 9648013C2B0; Wed, 14 Feb 2024 10:08:58 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 mail3.candelatech.com 9648013C2B0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=candelatech.com; s=default; t=1707934138; bh=Slk+qe7+wd3UQjJPJZX28GS89SLvGOhwEQPTnKc8Too=; h=Date:Subject:To:References:From:In-Reply-To:From; b=V2P9hVhxRj26JlYVXKdUpnY1AaH4t1fxnXZ+o3h34zMNIJobhlxWmn7xDdQa53d7A RYg3wJsHoN920ijSVd0wQr+3iP4AW8FfTPblmoyei2inhWbor7j43cBPPNsBIeOMW9 U59BIznvHhgI4hUImBe3ZCO8hS9SKkNaBmRrG/Bc= Message-ID: <35f63154-eb24-c279-9ae3-096f3aec75bc@candelatech.com> Date: Wed, 14 Feb 2024 10:08:58 -0800 Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: iwlwifi RFC related to iwl_mvm_tx_reclaim Content-Language: en-US To: "Korenblit, Miriam Rachel" , linux-wireless References: From: Ben Greear Organization: Candela Technologies In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-MDID: 1707934140-Q2_W04j051EM X-MDID-O: us5;ut7;1707934140;Q2_W04j051EM;;b05365583a7ac22983513582f8b41fd7 On 2/13/24 22:08, Korenblit, Miriam Rachel wrote: > : iwlwifi RFC related to iwl_mvm_tx_reclaim >> >> Hello, >> >> 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.). >> >> 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? >> >> diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c >> b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c >> index 0567f4eefebc..bd3d2fe424cd 100644 >> --- a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c >> +++ b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c >> @@ -2337,7 +2337,7 @@ static void iwl_mvm_tx_reclaim(struct iwl_mvm >> *mvm, int sta_id, int tid, >> sta = rcu_dereference(mvm->fw_id_to_mac_id[sta_id]); >> >> /* Reclaiming frames for a station that has been deleted ? */ >> - if (WARN_ON_ONCE(!sta)) { >> + if (IS_ERR(sta) || !sta) { >> rcu_read_unlock(); >> return; >> } >> > > Hi, > > Did you see this: 2b3eb122342c? > > This can explain why the code is how it is. > And no, you should not access the sta pointer before checking if IS_ERR. Thanks for the pointer. I think if I ever see the WARN_ON_ONCE(!sta) hit then I'd want to just try to remove that and let the reclaim code work, and check for null in the IS_ERR() logic added by the patch you referenced. But I have not seen sta be NULL, and Johannes is fine with current code, so for now I think it is fine as is. Thanks, Ben -- Ben Greear Candela Technologies Inc http://www.candelatech.com