From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796050475; b=eMxVO+igyYk3wcz8m0T3B4rm2WH84f8sYQL00WyaTZkN0xQOJTXaU5b/0Wvk3dUN9veq Gz3NsN2umsyMiRYTi3rTvGAaLHg6JZcesiRXyNg5NQDBT/xwOkn8x8+ifvvoBcVIE/Ul2 PugVveKFLnGamxK54xOr2rcG7+AlK8ROIIsV9GJLuBBYo/MHQT+2HAc4ia9t5Sb9Tn+5c x5JrYOsYgsrhepkemiuRlkS2+1F/R6HlwgKQHFirPL+ODfd0m87zWLqReP/wE7GiaBQuI Uob1US1pB0Q7eOXxFLltLFcDOSeVN/xdwFOk1kP8nRcnV+hQQCQv2q1obC3BQKLFPbQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796050475; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=XFU67bbjQrfGWZGcaggKsx5MK/TRGlaDyp+MpqxucPY=; b=doBp6AT2u6Whr6rl0ioq0Y9d5lbqAkMyBaXArbaW11gpb7PINr5wGa6rOK6zmIh9M2h+ hy5Cvf3lFHqXPjKjHxF9bMCWNw5ejNd/3IOoortDrxDpi4uK9R8LEpibKcxfMYhe7QpV/ r7dwhoAHc1fLGsM7yZk9KlfiiAAWjoUeT9N1dLgslRI5ijo3/TUuYaWx7aqV03zZ5gNn7 lw4EgCJatSJk5yAqRVBa7TLHskfKd7/6J/kcg4+ugJEoxwK3m+Va1Mj1bl6TK/XMUc2tX AgTNaNrz61z9IkKKyjdBlSI7Ww911opVRXDJKio2G2/8mV50njQOZFerwuO1sEyov5Q== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=MMbJucy7; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 13C8A606A31C for ; Mon, 30 Nov 2026 14:54:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=MMbJucy7 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6DD6C1F000C1; Mon, 30 Nov 2026 14:54:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796050474; bh=XFU67bbjQrfGWZGcaggKsx5MK/TRGlaDyp+MpqxucPY=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=MMbJucy74HcDtr2jMNUKloVy5Hvt9qhLEg7mgZw6yiIYKSJB5fXRW4fur9jumD6Nj ESPs6yURs0/DSqrZ/vB2fPMit04x5zvj/yBs8ftgklrx6k1ZsJMJu4zNVrJKtbIQns NPawHKcxfNE0Pm4C8bB6JbqKy5clJdIWR7I0+rC4spbb4cOXqx9Rydz2nvCUhUfelz RtDaK2OE9drN4MiObLi1+ubADb9xlRArhyTGJjMPLD7VcIC2U88HrhCOzQqNL4zE0d qOwPd2Q73w5/HmIjVHh4Q8H6l+q77oEEbEZvm6Hf8ypZYEgMKE/l/sUk3F3sJWw5Ma CAk0x+2COHeUQ== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v2 4/4] virtiofs: fix forget leak on submount unmount Reply-To: sashiko-reviews@lists.linux.dev To: "Miklos Szeredi" , virtualization@lists.linux.dev Cc: "Michael S. Tsirkin" , "Eugenio Perez" In-Reply-To: <20261130143728.326871-4-mszeredi@redhat.com> References: <20261130143728.326871-1-mszeredi@redhat.com> <20261130143728.326871-4-mszeredi@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Mon, 30 Nov 2026 14:54:34 +0000 X-Mailing-List: virtualization@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Medium] fuse: forget leak and premature FORGET in fuse_evict_inode() on failed mount -- commit 6888c05c6b67c7c443bc776bdec5c1257aae460e Author: Miklos Szeredi virtiofs: fix forget leak on submount unmount This commit moves the queuing of fi->forget and cleanup of fi->submount_lookup in fuse_evict_inode() outside the SB_ACTIVE check so that submount unmounts do not skip them. > diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c > index eff1c05681e6b..613c203dcd506 100644 > --- a/fs/fuse/inode.c > +++ b/fs/fuse/inode.c > @@ -141,6 +141,7 @@ static void fuse_cleanup_submount_lookup(struct fuse_= conn *fc, > static void fuse_evict_inode(struct inode *inode) > { > struct fuse_inode *fi =3D get_fuse_inode(inode); > + struct fuse_conn *fc =3D get_fuse_conn(inode); > =20 > /* Will write inode on close/munmap and in all other dirtiers */ > WARN_ON(inode_state_read_once(inode) & I_DIRTY_INODE); > @@ -157,19 +158,27 @@ static void fuse_evict_inode(struct inode *inode) > */ > if (FUSE_IS_VDAX(inode)) > fuse_vdax_inode_cleanup(inode); > - if (inode->i_sb->s_flags & SB_ACTIVE) { > - struct fuse_conn *fc =3D get_fuse_conn(inode); > + /* > + * Must be done unconditionally as well: on a submount unmount the > + * connection stays alive and no FUSE_DESTROY is sent, so without > + * this the server keeps the lookup counts of every inode in the > + * submount for the lifetime of the connection. The > + * fuse_submount_lookup object is freed nowhere else, so skipping it > + * leaks that too. If the connection is already gone (full unmount, > + * failed mount) fuse_chan_queue_forget() just frees the forget. > + */ > + if (fi->nlookup) { > + fuse_chan_queue_forget(fc->chan, fi->forget, fi->nodeid, > + fi->nlookup); > + fi->forget =3D NULL; > + } [Severity: Medium] Does this leak fi->forget when fuse_fill_super_common() fails after allocating the root inode? In fuse_fill_super_common(), fuse_get_root_inode() creates the root inode with fi->nlookup =3D 1 while sb->s_root is still NULL and fc->chan->iq.connected is already 1. If d_make_root(), fuse_dev_is_installed(), or fuse_ctl_add_conn() then fails, evicting the root inode queues fi->forget onto fc->chan->iq.forget_list_tail and clears fi->forget =3D NULL instead of letting fuse_free_inode() free it. During superblock teardown, fuse_sb_destroy() skips fuse_conn_destroy() and fuse_chan_abort() because sb->s_root is NULL: fs/fuse/inode.c:fuse_sb_destroy() { ... if (sb->s_root) { last =3D fuse_mount_remove(fm); if (last) fuse_conn_destroy(fm); } } As a result, fi->forget is never drained from forget_list_head before fc->chan is freed. On virtiofs, where the virtqueues are already connected at probe time, the same failure path sends a FUSE_FORGET for FUSE_ROOT_ID to the server before FUSE_INIT. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261130143728.3268= 71-1-mszeredi@redhat.com?part=3D4