mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hyunchul Lee <hyc.lee@gmail.com>
To: Baolin Liu <liubaolin12138@163.com>
Cc: linkinjeon@kernel.org, ntfs@lists.linux.dev,
	linux-kernel@vger.kernel.org, Baolin Liu <liubaolin@kylinos.cn>
Subject: Re: [PATCH 2/5] ntfs: return -ENOMEM from ntfs_inode_attach_all_extents()
Date: Thu, 3 Sep 2026 14:25:50 +0900	[thread overview]
Message-ID: <apkE3nzoVd0raTde@hyunchul-PC02> (raw)
In-Reply-To: <20260902073249.3035977-3-liubaolin12138@163.com>

On Wed, Sep 02, 2026 at 03:32:46PM +0800, Baolin Liu wrote:
> From: Baolin Liu <liubaolin@kylinos.cn>
> 
> ntfs_inode_attach_all_extents() returns -1 when ntfs_extent_inode_open()
> fails, and both callers propagate it unchanged, so userspace sees EPERM
> from setxattr, reparse point creation and directory index updates on
> inodes with an attribute list.
> 
> Both paths that return NULL here are allocation failures: the
> kmem_cache_alloc() in ntfs_new_extent_inode() and the kvzalloc() that
> grows ext.extent_ntfs_inos[]. Return -ENOMEM.
> 
> Fixes: af0db57d4293 ("ntfs: update inode operations")
> Signed-off-by: Baolin Liu <liubaolin@kylinos.cn>
> ---
>  fs/ntfs/inode.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/ntfs/inode.c b/fs/ntfs/inode.c
> index 5aedc045f65a..747a60ae27c9 100644
> --- a/fs/ntfs/inode.c
> +++ b/fs/ntfs/inode.c
> @@ -3025,7 +3025,7 @@ int ntfs_inode_attach_all_extents(struct ntfs_inode *ni)
>  				prev_attached != MREF_LE(ale->mft_reference)) {
>  			if (!ntfs_extent_inode_open(ni, ale->mft_reference)) {
>  				ntfs_debug("Couldn't attach extent inode.\n");
> -				return -1;
> +				return -ENOMEM;

Could you also fix the error handling of ntfs_extent_inode_open()?
It treats the failure of map_mft_record() as success. If we would 
fix that, this patch would incorrectly convert every failures to
ENOMEM.

>  			}
>  			prev_attached = MREF_LE(ale->mft_reference);
>  		}
> -- 
> 2.51.0
> 

-- 
Thanks,
Hyunchul

  reply	other threads:[~2026-09-03  5:25 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-02  7:32 [PATCH 0/5] ntfs: fix incorrect error codes returned to callers Baolin Liu
2026-09-02  7:32 ` [PATCH 1/5] ntfs: return -EINVAL from ntfs_collate_ntofs_ulongs() on bad length Baolin Liu
2026-09-02  7:32 ` [PATCH 2/5] ntfs: return -ENOMEM from ntfs_inode_attach_all_extents() Baolin Liu
2026-09-03  5:25   ` Hyunchul Lee [this message]
2026-09-03  6:43     ` liubaolin
2026-09-03  7:20       ` Hyunchul Lee
2026-09-02  7:32 ` [PATCH 3/5] ntfs: preserve the truncate error in ntfs_enlarge_attribute() Baolin Liu
2026-09-02  7:32 ` [PATCH 4/5] ntfs: propagate the map_mft_record() error in ntfs_attrlist_entry_add() Baolin Liu
2026-09-02  7:32 ` [PATCH 5/5] ntfs: propagate the ntfs_attr_iget() error in update_reparse_data() Baolin Liu

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=apkE3nzoVd0raTde@hyunchul-PC02 \
    --to=hyc.lee@gmail.com \
    --cc=linkinjeon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liubaolin12138@163.com \
    --cc=liubaolin@kylinos.cn \
    --cc=ntfs@lists.linux.dev \
    /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

all inboxes | Powered by JetHome®