Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: Penglei Jiang <superman.xpt@gmail.com>
To: stable@vger.kernel.org
Cc: Penglei Jiang <superman.xpt@gmail.com>
Subject: [PATCH v2 6.14.y] btrfs: fix the inode leak in btrfs_iget()
Date: Mon,  5 May 2025 08:03:22 -0700	[thread overview]
Message-ID: <20250505150322.40733-1-superman.xpt@gmail.com> (raw)
In-Reply-To: <2025050558-charger-crumpled-6ca4@gregkh>

The commit 48c1d1bb525b1c44b8bdc8e7ec5629cb6c2b9fc4 fails to compile
in kernel version 6.14.

Version 6.14:
    struct inode *btrfs_iget(u64 ino, struct btrfs_root *root)
    {
            struct inode *inode;
            ~~~~~~~~~~~~~~
            ...
            inode = btrfs_iget_locked(ino, root);
            ...
    }

Version 6.15:
    struct btrfs_inode *btrfs_iget(u64 ino, struct btrfs_root *root)
    {
            struct btrfs_inode *inode;
            ~~~~~~~~~~~~~~~~~~~~
            ...
            inode = btrfs_iget_locked(ino, root);
            ...
    }

In kernel version 6.14, the function btrfs_iget_locked() returns a
struct inode *, so the patch code adjusts to use iget_failed(inode).

Reported-by: Penglei Jiang <superman.xpt@gmail.com>
Link: https://lore.kernel.org/linux-btrfs/20250421102425.44431-1-superman.xpt@gmail.com/
Fixes: 7c855e16ab72 ("btrfs: remove conditional path allocation in btrfs_read_locked_inode()")
Signed-off-by: Penglei Jiang <superman.xpt@gmail.com>
---
 fs/btrfs/inode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index ad7009d336fa..d2edb2201e3a 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -5660,7 +5660,7 @@ struct inode *btrfs_iget(u64 ino, struct btrfs_root *root)
 
 	path = btrfs_alloc_path();
 	if (!path) {
-		iget_failed(&inode->vfs_inode);
+		iget_failed(inode);
 		return ERR_PTR(-ENOMEM);
 	}
 
-- 
2.17.1


  reply	other threads:[~2025-05-05 15:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-05  7:41 FAILED: patch "[PATCH] btrfs: fix the inode leak in btrfs_iget()" failed to apply to 6.14-stable tree gregkh
2025-05-05 15:03 ` Penglei Jiang [this message]
2025-05-07  9:23   ` [PATCH v2 6.14.y] btrfs: fix the inode leak in btrfs_iget() Greg KH
2025-05-08 16:18   ` Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250505150322.40733-1-superman.xpt@gmail.com \
    --to=superman.xpt@gmail.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox