From nobody Sat May 11 19:48:41 2024 X-Original-To: net@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 4VcGXC41knz5Kh3R for ; Sat, 11 May 2024 19:48:43 +0000 (UTC) (envelope-from bugzilla-noreply@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 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4VcGXC1Td7z4Vjq for ; Sat, 11 May 2024 19:48:43 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1715456923; a=rsa-sha256; cv=none; b=WC5U2h8tdLb8Yi/wTmUQ6upDZCGfBiflTGKybR3owoFgW59Ah0wDDlci6JR5l/Ua+TRvkr rfXHPLyCLKgU6wD2LfoM5ywm3cCX7vZbekxqd0F2D8aOBtup7L0ogx1dhgm8x2B3Bl938D RfjEdI0wTmQAfyIRe6C74cEy2AbSotFD1S9NTrZu4Ckfi5Qd7M5vBnr76xz/byYqQAyUyx jGqcoNEGqEZAQbpCwGS0EJziuMQ1guGOoh+jVcUI42WxkXM/Dw27chSIF/M9kNjt0fSpVC Jpcd67Z4eYD7223SfgMgPhXQBMyPxDWX6wyZkzfYF7v/otinbZNa7H5xpXPxCw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1715456923; 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: in-reply-to:in-reply-to:references:references; bh=uIKVgx67Qsjy8kg335ZuDSs5Ldv7Pnh9GQn+ehTNOIQ=; b=kYfKqYi9QfOIX/PBICtdV/M/i9Z8HGfIRbo04xZFtet8Gxznthe7E2aVeLS7Fa8RkxBUHu 2rvEq2YjM6qlmWe4Lj0MnXehKZhvYgl4DwCsK5y6VNOTJqkxv3M6UN5xwyLwwBL04UL6GO 5kIPMzphuANwhZWI/XMM9nmqS2Tqo5saT3bxylvAbJJNPLtXUJzmaUuRMbziawHWfZ1dla BHTiAmZDTDmLEyONJAdg+pdA+lvK5IQZu/uQwl9jFYxKLpU7ZCJxCm/xnanOc/a9d2iixC BJUW9fel/4GibAMs044sfAZ2rcRl0fB/XU89Ds3qKyxIFYCMVL8AecjBhfoFOQ== Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (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) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VcGXC166WzZNK for ; Sat, 11 May 2024 19:48:43 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 44BJmhlZ091368 for ; Sat, 11 May 2024 19:48:43 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 44BJmhNt091363 for net@FreeBSD.org; Sat, 11 May 2024 19:48:43 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: net@FreeBSD.org Subject: [Bug 237921] wpi: Memory leak in function wpi_free_tx_ring of sys/dev/wpi/if_wpi.c Date: Sat, 11 May 2024 19:48:41 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: wireless X-Bugzilla-Version: CURRENT X-Bugzilla-Keywords: needs-qa, patch X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: bz@FreeBSD.org X-Bugzilla-Status: In Progress X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: wireless@FreeBSD.org X-Bugzilla-Flags: mfc-stable13? mfc-stable12? X-Bugzilla-Changed-Fields: cc bug_status Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Networking and TCP/IP with FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-net List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-net@FreeBSD.org MIME-Version: 1.0 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D237921 Bjoern A. Zeeb changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bz@FreeBSD.org Status|Open |In Progress --- Comment #9 from Bjoern A. Zeeb --- (In reply to Yusuf Khan from comment #8) I cannot follow the logic. wpi_free_tx_ring() is called from device detach (ignoring the attach error path); the mbuf/ring descriptor will not be used beyond that function anym= ore at that stage so there is no need to set it to NULL anymore. That would ju= st be a NOP. If there's still a reference to a ni at that stage, then other cleanup hasn= 't worked at the beginning of wpi_detach(). There should be no more ni; in f= act that should also be no more mbuf attached on the TX ring so I would even question if that code path is ever taken. This function is basically doing the opposite of wpi_alloc_tx_ring(). wpi_reset_tx_ring() on the contrary leaves all resources in place and only cleans up any outstanding transations and resets the ring to default values= ;=20 this happens in wpi_hw_stop(). And then the resources will be re-used again after wpi_parent() goes through the bringup part again (a VAP/wlan interfac= e is brought up again). So let me ask what lead to the original assumption that there may be a memo= ry leak and a possible use-after-free. If you indeed believe that, I would love to know the code path which can trigger it. --=20 You are receiving this mail because: You are on the CC list for the bug.=