From nobody Mon May 25 14:34:13 2026 X-Original-To: bugs@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 4gPJKy10ysz6f3Lk for ; Mon, 25 May 2026 14:34:14 +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 "R13" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gPJKx3GYyz3fGr for ; Mon, 25 May 2026 14:34:13 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779719653; 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=aQ2ye30WpbckHQa8Vx5Dy6sxDDmqI9C65L2+m4d8tFc=; b=UWKW2gW/GhJdhVcToKvnG7ua1abAYsn1m294C/1nR59WwDfp2y5z8u5/GTKIzYwc3bAEOQ 1u+f9zhrdHItSbSWSTW8f6Cz5FsWp1iIZGNJGcHZi8p3NrF2Th+yqKnMz62ZaFy0E4sFEI otDdz/8NFImV+3xmB1AbP6ZtyQadu4DsL6tAaobRjSyqLjcPnhWssgrw4BChGbMWtaDQMV Ly+0GQJ6jBBqDakVB2WwM7y+3ZY+MAVVjzfAnIrQnspwT1xBa2ogd473V9hUbDpE/js+VI YESZ+1J/qnc//AsBClakz1ETdbt/GT6eKYGIadjl41LFpGei3CK1Vgw3LnYd3g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779719653; a=rsa-sha256; cv=none; b=xQMNyLrdUk1Yv1yh7FC7/kaOnMqPP7pD9p1IfNuLnVWeBsg2dlEMIjlFtpKSuqwoDORGvB i+aFtpYnBvYCzNK03WZ2R7Slz1yFkAKUEz6nH7M8EmdAiml65CnrH/gAerdityxmrJG1l7 K7JkOi3v0D9zmeQkZGkLbAISm6+4ekYTYEAVTE/rWaV2bHauS3KqzjmdNNBs0zSSncP6et sv5abrNCYUa1MFdIKhv4OoxdMcPJjcLOBULazm4UX74Hq107WBaLJeD5Ao7Yb+rYcNkAwS H+Zo85nJxS+0cFUQoBAmMCpi/ajm9226Au1rwXYXb4R9G/RLoiy/o9dPTFMPTg== 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=1779719653; 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=aQ2ye30WpbckHQa8Vx5Dy6sxDDmqI9C65L2+m4d8tFc=; b=aNFjjo3e2hfHTONkmlXlvaffkj7NE9zhss1xnYIoI8k8S6LuzLSZirZ4dPpM2+8rUHZ4rN WEHGBisN92LQS0qX2yvsmCYm7AbJOBFM/yFWSoIxVH6ZNB0gWoOsk3iEfD/XB6MHsCA9sI QEUbIqPNT4pnKlgO9I5e08pVxVfdn7VFWB/SIyUdIoPTKtf/BmunfJA6gfLd6bJhRv1X7c Q3UFt9J7RpD84PYaa2Le3ej4p17vjD7ob9iT0PBS01h+td9yNqFsKNi090UxBjw0QVeRl5 nSoCjJ5y8wealk6E/xSvhXdZnUGY8y8jrKIOXTDLleh4qgF3/Awv2QwFvWpVkw== 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 4gPJKx2nvpzm14 for ; Mon, 25 May 2026 14:34:13 +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 64PEYDLw034192 for ; Mon, 25 May 2026 14:34:13 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 64PEYDwS034191 for bugs@FreeBSD.org; Mon, 25 May 2026 14:34:13 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: bugs@FreeBSD.org Subject: [Bug 295577] smbfs: smbfs_node_alloc() leaks name buffers when insmntque() fails Date: Mon, 25 May 2026 14:34:13 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: 14.4-RELEASE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: lihaoxiang@isrc.iscas.ac.cn X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter attachments.created Message-ID: Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="UTF-8" X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D295577 Bug ID: 295577 Summary: smbfs: smbfs_node_alloc() leaks name buffers when insmntque() fails Product: Base System Version: 14.4-RELEASE Hardware: Any OS: Any Status: New Severity: Affects Some People Priority: --- Component: kern Assignee: bugs@FreeBSD.org Reporter: lihaoxiang@isrc.iscas.ac.cn Created attachment 271120 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D271120&action= =3Dedit Fix smbfs_node_alloc() cleanup on insmntque() failure smbfs_node_alloc() leaks np->n_rpath and np->n_name on the insmntque() failure path. I tested this on FreeBSD 14.4-RELEASE, but the affected code path does not appear to be specific to this version. bug #265148, comment #2 discussed a related situation. That reasoning is correct for the vfs_hash_insert() failure path. However, before insmntque() calls vgone(), vp->v_op has already been changed to dead_vnodeops. Therefor= e, VOP_RECLAIM resolves to VOP_NULL rather than smbfs_reclaim(), and the resou= rces owned by np are not reclaimed on this path. I tested this in a FreeBSD 14.4-RELEASE amd64 QEMU VM using fault injection that temporarily sets MNTK_UNMOUNT | MNTK_UNMOUNTF before calling insmntque= (), forcing the real insmntque1_int() EBUSY path. After the failed mount, vmstat -m showed: Type Use Memory Req Size(s) smbufs_node 0 0 1 256 smbufs_nname 2 32 2 16 This shows that np was freed, but the two M_SMBNODENAME allocations, np->n_rpath and np->n_name, remained active. I also tested the vfs_hash_insert() duplicate-vnode path separately. That p= ath does not appear to leak, because vfs_hash_insert() calls vgone(vp) while vp->v_op is still smbfs_vnodeops, so smbfs_reclaim() runs and frees the smb= node resources. Repeated forced vfs_hash_insert() duplicate insertions increased= the Req counters but did not increase the active Use counters. After unmount, b= oth smbufs_node and smbufs_nname Use returned to zero. Thus, cleanup is necessary when insmntque() fails. --=20 You are receiving this mail because: You are the assignee for the bug.=