From nobody Sat Oct 17 21:38:08 2026 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4j6Zt94TjTz6wqNS for ; Sat, 17 Oct 2026 21:38:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4j6Zt90rgwz55bw for ; Sat, 17 Oct 2026 21:38:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1792273089; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=MCxKEMh7EMunl8PW85AbDzNQ1aJa3mI2/K7i4/YT0es=; b=j5lYVjbhGuv+Em7iOVMcdCEgM9VuSGZKLtyWRIZVS7ecp94/LIL83MsH0Tfbqz7Yl/4+d7 v1QboW9QS/w+7eKTau9agRXjGDtrM5o3Zusx5wH0G1iAIS0K0/jTbMVclin00em3I0QunJ kcwaLwBzmhzgWRK5KdB+M/3ZPt552RQVDr6dLCC9/emEuyT/W3oX4I2pwkUq9ZsXS3gq+c lNFiLd/gFVwFtBzMO2v8m9RZqBhz/d+igPinGAs8N/linY8p585CbVdb566DopJXqZwWbu kClV1lBfMdlREmllts8csUo9XaLJjQp3CvC5twC9t7A5OLw0987yZHGG64rMEg== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1792273089; b=FjEdUpKPqXVfYPEHym/55arr79a8IotEMcW6QYtLQXy/Wy7A04dC7kvxXpA2P/77jVVLNX XSkOW7Lng3yZtM8GxDCr2zZSa1g4DQJVH8ZAdFcG1oqOBzH1I0gmcAvxtmOhu9wuLGO9cv k67y0QX2B42ePUP4VSnI8jo02EY3q7bM6abLZVR8uti7Xux/oR1WynS9ergvGAPgHcb5ia pwv/MzkJ//VXh8EGIlGDLInj/avb7eYHDm4MZbALcVAMbhPhDoo31/UQKB6GId00Hjq08I V+Wp6DLxRTGqAi2lBhlVCtqmU3uvMfp/mjoUlDzFQc3wyWO35oZSrQm3yzZewA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1792273089; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=MCxKEMh7EMunl8PW85AbDzNQ1aJa3mI2/K7i4/YT0es=; b=o9RenKR/MGw/TWEiZxbdMiw0AncyoVPdeGdzNZxq/fus96ETqPecSGdxdbszcFMCaIb0/0 b9Nuc5vupaOtrq5GNLXLI3WmVVzGLj+BN0JAMUE8QoagVCWdUupybWmy/bZl5y3eiqvVA8 IJlAdPW8HxLR/9nIIFC1IpxSQ+qgg6JjUq2iW1WCF/00jxa/Sa88bovyiViOns46WA7jpK DDQSUpAEe0g9/4aYSdL3xxWk89mv29KQrrOnOXHtJxmEnlq4haMM4pyG5fUOstA/qGR44R Drqm1KKqC73+kYN3EFQXRsnfqE2Yac+3TfVLVHE9kAfoNIHiMnTZKnuAXfEkFQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4j6Zt872W3zK5V for ; Sat, 17 Oct 2026 21:38:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3f438 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sat, 17 Oct 2026 21:38:08 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: 461da47e45e7 - main - iwm: mask closed_rb_num to the RX ring size List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org List-Id: Commit messages for the main branch of the src repository List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 461da47e45e7f8ef8754875f4820d3855e7f4097 Auto-Submitted: auto-generated Date: Sat, 17 Oct 2026 21:38:08 +0000 Message-Id: <6ad3eac0.3f438.44f6342@gitrepo.freebsd.org> The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=461da47e45e7f8ef8754875f4820d3855e7f4097 commit 461da47e45e7f8ef8754875f4820d3855e7f4097 Author: Adrian Chadd AuthorDate: 2026-10-17 21:32:51 +0000 Commit: Adrian Chadd CommitDate: 2026-10-17 21:32:51 +0000 iwm: mask closed_rb_num to the RX ring size iwm_notif_intr() reads hw = le16toh(sc->rxq.stat->closed_rb_num) & 0xfff and loops while (sc->rxq.cur != hw) without masking hw to the ring size (512 entries for 9000-series MQ RX, 256 for legacy). If the hardware reports a value at or above the ring size, cur never equals hw: the loop walks stale ring entries indefinitely and the write-pointer update uses a bogus index. Linux iwlwifi masks the value (5eae443eb5e2) and OpenBSD has done the same since 9000-series support was added (3287dca4fa10). This was found while debugging an iwm crash on another BSD using the same driver lineage (DragonFly, upstream bug 3449) Locally tested: * 7260, 9260, STA mode PR: kern/299427 Submitted by: David Bidner Differential Revision: https://reviews.freebsd.org/D60824 --- sys/dev/iwm/if_iwm.c | 2 ++ sys/dev/iwm/if_iwmvar.h | 1 + 2 files changed, 3 insertions(+) diff --git a/sys/dev/iwm/if_iwm.c b/sys/dev/iwm/if_iwm.c index 1bd07fa07102..dcf1e64ad6e1 100644 --- a/sys/dev/iwm/if_iwm.c +++ b/sys/dev/iwm/if_iwm.c @@ -6083,6 +6083,8 @@ iwm_notif_intr(struct iwm_softc *sc) } hw = le16toh(sc->rxq.stat->closed_rb_num) & 0xfff; + /* Mask the returned value to the hardware ring size */ + hw &= (count - 1); /* * Process responses diff --git a/sys/dev/iwm/if_iwmvar.h b/sys/dev/iwm/if_iwmvar.h index 4497bd91c8a1..92c70dee4eb9 100644 --- a/sys/dev/iwm/if_iwmvar.h +++ b/sys/dev/iwm/if_iwmvar.h @@ -293,6 +293,7 @@ struct iwm_tx_ring { int cur; }; +/* Note: these are used as a mask; must be a power of 2 */ #define IWM_RX_LEGACY_RING_COUNT 256 #define IWM_RX_MQ_RING_COUNT 512