From nobody Sat Sep 26 06:15:31 2026 Received: from m16.mail.163.com (m16.mail.163.com [117.135.210.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D3EB03FC5C9 for ; Fri, 4 Sep 2026 09:01:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=117.135.210.2 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788512505; cv=none; b=Mb9/Rz4Agl6ea9xblRwHd9mhS2oMe5XuP0wlZefqXzvp5zLKGC3ec8t2DUkBTCcxBGKNq/MOCA86y9WhOlRIrFgdN5vTFEd4U7R+dlIPlDS9mjwBYofI38hfdhUyyu3mmdhh+4j4ZOhX+lFDS+7pDKxquk63s/bXE4dv1rtkFbI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788512505; c=relaxed/simple; bh=9uBlqEjiAXyypijmEOGf0qaPPewJUOcsaqPql5duWsc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uvGH2ohc4YV/TGcEITJWvgIQ47MoAQ2HxMiTMB8TBN7Vx0neuxZJxwt+2FNJIxSGOKwSXNLhmLLHHLJTNtpB64qvlgReydhyF2Y2byDvV2HmXdGrq1+0tsNMalk+i5J6ZfkxpLydb3RBoS2lZr8dO50N5IGZfDEgZ79xqG44GNs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com; spf=pass smtp.mailfrom=163.com; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b=FAu47L+M; arc=none smtp.client-ip=117.135.210.2 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=163.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b="FAu47L+M" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:To:Subject:Date:Message-ID:MIME-Version; bh=jR n1xiWbbjvW1QMlGXZTnpr3hkMo6O3/2pu4o6mX07U=; b=FAu47L+M97h+jIwzTh 3AgJrv8UYyEALapQvqomWmLOVLFHR61bWfWmK0tbn0Zv5hwhokmahliCml3USiJC 01BQTvxygjOVMNEwG8cmMWenp2XNTRzTrrnlPT8ImWu94LkF00e12NmJyDeeilI7 kIVmYbJvTGEZitao697FK0Svc= Received: from liubaolin-ThinkPad-E15-Gen-2 (unknown []) by gzga-smtp-mtada-g1-4 (Coremail) with SMTP id _____wAHU97ViJpqDNWCAg--.41284S3; Fri, 04 Sep 2026 17:01:13 +0800 (CST) From: Baolin Liu To: linkinjeon@kernel.org, hyc.lee@gmail.com Cc: ntfs@lists.linux.dev, linux-kernel@vger.kernel.org, Baolin Liu Subject: [PATCH v2 1/5] ntfs: return -EINVAL from ntfs_collate_ntofs_ulongs() on bad length Date: Fri, 4 Sep 2026 17:00:50 +0800 Message-ID: <20260904090054.3365538-2-liubaolin12138@163.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260904090054.3365538-1-liubaolin12138@163.com> References: <20260904090054.3365538-1-liubaolin12138@163.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CM-TRANSID: _____wAHU97ViJpqDNWCAg--.41284S3 X-Coremail-Antispam: 1Uf129KBjvJXoW7KFyfZFWkGFWruw4DtF1UWrg_yoW8JFW3pF 9rCFn7Ga1kJr12yrs2yr43GayavwnrGr47t390gw1xX3sYqF1rtr1FqF1I9r4IvaykZw4r Xr10q3y3ZrykZaDanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07UMWl9UUUUU= X-CM-SenderInfo: xolxutxrol0iasrtmqqrwthudrp/xtbC6RqZZGqaiNqvVQAA3W Content-Type: text/plain; charset="utf-8" From: Baolin Liu ntfs_collate_ntofs_ulongs() returns -1 when the key lengths differ or are not a multiple of 4. But -1 is also what cmp_int() returns for "collates before", so the error is indistinguishable from an ordinary result. ntfs_ie_lookup() acts on that difference: it maps -EINVAL to -ERANGE, but treats -1 as a tree-descent hint and breaks out of the loop. A malformed entry in $Reparse/$R or $ObjId/$O is therefore silently taken as a lookup miss. Return -EINVAL, as the sibling ntfs_collate_ntofs_ulong() already does. Well-formed keys are unaffected; both indexes use key sizes that are multiples of 4. Fixes: 5218cd102aec ("ntfs: update misc operations") Signed-off-by: Baolin Liu Reviewed-by: Hyunchul Lee --- fs/ntfs/collate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/ntfs/collate.c b/fs/ntfs/collate.c index 77e34038902d..744fdfd7bf58 100644 --- a/fs/ntfs/collate.c +++ b/fs/ntfs/collate.c @@ -73,7 +73,7 @@ static int ntfs_collate_ntofs_ulongs(struct ntfs_volume *= vol, =20 if (data1_len !=3D data2_len || data1_len & 3) { ntfs_error(vol->sb, "data1_len or data2_len not valid\n"); - return -1; + return -EINVAL; } =20 len =3D data1_len; --=20 2.51.0 From nobody Sat Sep 26 06:15:31 2026 Received: from m16.mail.163.com (m16.mail.163.com [220.197.31.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CB0E83E5A29 for ; Fri, 4 Sep 2026 09:01:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=220.197.31.4 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788512502; cv=none; b=mcFKWEAdDrISEBmq+ja3+dAhsrWujdYGrWj+zGgRYZ2cMdQzocO4XsZIhpyb8gpEamk/8p9FaaGqcXIf6hZpuDNmpqGgJAG3vPPopByHdnao5rs2U/iIKoAws57CiEe8hv3lCBiF6i1xnufztLYmv8qQdshcOOwFUNVAniPzM0g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788512502; c=relaxed/simple; bh=ZBNlgBctMhChDAE7o/5kMOQwK6g5AZoQLqncJ0hGTbU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rS8BtG3drI03FdRmImLIoos59iGBW0prXDGNABvyXMBBO6ry2rTsg5kyoDlZ3XVIKKK2qy5yM03/vwHaTaNj6wAZhGjvpRy9eMSq2YuhgiJ0oNkYlkcQtpIK2V26ePvqYSmpaEdNUWJ6x8sU2xuEF63KFIafNAW+Hu7Dphy82zE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com; spf=pass smtp.mailfrom=163.com; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b=JfYLFhWT; arc=none smtp.client-ip=220.197.31.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=163.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b="JfYLFhWT" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:To:Subject:Date:Message-ID:MIME-Version; bh=na ms8Fs7eVl6yuVlTVHApCwYJyqrJBhy/Ngo/qTmZsI=; b=JfYLFhWTbqZCTl2Ffa SoyJ9DPgTkH/GuMr3jdhoUBR1rx2JjbvgCBHO/tdLZkx8q5WAyHw9MS1kiIjDyx6 ZvWBkgZOsq1Kc0MzIcZ6mcjlm1Gq3c0q5LgUtVeiimk6nktk0kuVMKFXMSNkwZPZ DL2ZpQtQpZgZ+IljwcxyJEQ3s= Received: from liubaolin-ThinkPad-E15-Gen-2 (unknown []) by gzga-smtp-mtada-g1-4 (Coremail) with SMTP id _____wAHU97ViJpqDNWCAg--.41284S4; Fri, 04 Sep 2026 17:01:17 +0800 (CST) From: Baolin Liu To: linkinjeon@kernel.org, hyc.lee@gmail.com Cc: ntfs@lists.linux.dev, linux-kernel@vger.kernel.org, Baolin Liu Subject: [PATCH v2 2/5] ntfs: fix error handling in ntfs_extent_inode_open and propagate errors Date: Fri, 4 Sep 2026 17:00:51 +0800 Message-ID: <20260904090054.3365538-3-liubaolin12138@163.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260904090054.3365538-1-liubaolin12138@163.com> References: <20260904090054.3365538-1-liubaolin12138@163.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CM-TRANSID: _____wAHU97ViJpqDNWCAg--.41284S4 X-Coremail-Antispam: 1Uf129KBjvJXoWxuryfKF45ZrWDur4rCFy3urg_yoWrGFykpF sruw1xtw47Jry7KrWvyr4q9FyakF4xKrW7Gr1Dtwn7Aas8t340vF1Utr109F1SyrZ5t34S vr4jka17ua47ZFDanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jyxRhUUUUU= X-CM-SenderInfo: xolxutxrol0iasrtmqqrwthudrp/xtbC6h2aZWqaiN051QAA3B Content-Type: text/plain; charset="utf-8" From: Baolin Liu ntfs_extent_inode_open() has two issues: 1. When map_mft_record() fails, it returns the non-NULL 'ni' pointer instead of an error, causing the caller to treat the failure as success. 2. It returns NULL for all errors, losing information about what actually went wrong (-EIO, -ENOMEM, -EINVAL, etc.). Fix both by converting the function to return ERR_PTR() on error, and update the single caller (ntfs_inode_attach_all_extents) to check with IS_ERR() and propagate the actual error code with PTR_ERR(). Fixes: af0db57d4293 ("ntfs: update inode operations") Signed-off-by: Baolin Liu --- fs/ntfs/inode.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/fs/ntfs/inode.c b/fs/ntfs/inode.c index 5aedc045f65a..xxxxxxxxxxxx 100644 --- a/fs/ntfs/inode.c +++ b/fs/ntfs/inode.c @@ -2904,8 +2904,7 @@ static inline void ntfs_init_big_inode(struct inode *= vi) * abort if deprotection or checks fail. * * Finally attach the ntfs inode to its base inode @base_ni and return a - * pointer to the ntfs_inode structure on success or NULL on error, with e= rrno - * set to the error code. + * pointer to the ntfs_inode structure on success or ERR_PTR() on error. * * Note, extent inodes are never closed directly. They are automatically * disposed off by the closing of the base inode. @@ -2921,7 +2920,7 @@ static struct ntfs_inode *ntfs_extent_inode_open(stru= ct ntfs_inode *base_ni, struct super_block *sb; if (!base_ni) - return NULL; + return ERR_PTR(-EINVAL); sb =3D base_ni->vol->sb; ntfs_debug("Opening extent inode %llu (base mft record %llu).\n", @@ -2940,7 +2939,7 @@ static struct ntfs_inode *ntfs_extent_inode_open(stru= ct ntfs_inode *base_ni, if (IS_ERR(ni_mrec)) { ntfs_error(sb, "failed to map mft record for %llu", ni->mft_no); - goto out; + return ERR_PTR(PTR_ERR(ni_mrec)); } /* Verify the sequence number if given. */ seq_no =3D MSEQNO_LE(mref); @@ -2949,7 +2948,7 @@ static struct ntfs_inode *ntfs_extent_inode_open(stru= ct ntfs_inode *base_ni, ntfs_error(sb, "Found stale extent mft reference mft=3D%llu", ni->mft_no); unmap_mft_record(ni); - goto out; + return ERR_PTR(-EINVAL); } unmap_mft_record(ni); goto out; @@ -2958,7 +2957,7 @@ static struct ntfs_inode *ntfs_extent_inode_open(stru= ct ntfs_inode *base_ni, /* Wasn't there, we need to load the extent inode. */ ni =3D ntfs_new_extent_inode(base_ni->vol->sb, mft_no); if (!ni) - goto out; + return ERR_PTR(-ENOMEM); ni->seq_no =3D (u16)MSEQNO_LE(mref); ni->nr_extents =3D -1; @@ -2968,8 +2967,10 @@ static struct ntfs_inode *ntfs_extent_inode_open(str= uct ntfs_inode *base_ni, i =3D (base_ni->nr_extents + 4) * sizeof(struct ntfs_inode *); extent_nis =3D kvzalloc(i, GFP_NOFS); - if (!extent_nis) + if (!extent_nis) { + ni =3D ERR_PTR(-ENOMEM); goto err_out; + } if (base_ni->nr_extents) { memcpy(extent_nis, base_ni->ext.extent_ntfs_inos, i - 4 * sizeof(struct ntfs_inode *)); @@ -2984,7 +2985,6 @@ static struct ntfs_inode *ntfs_extent_inode_open(stru= ct ntfs_inode *base_ni, return ni; err_out: ntfs_destroy_ext_inode(ni); - ni =3D NULL; goto out; } @@ -3025,9 +3025,12 @@ int ntfs_inode_attach_all_extents(struct ntfs_inode = *ni) while ((u8 *)ale < ni->attr_list + ni->attr_list_size) { if (ni->mft_no !=3D MREF_LE(ale->mft_reference) && prev_attached !=3D MREF_LE(ale->mft_reference)) { - if (!ntfs_extent_inode_open(ni, ale->mft_reference)) { + struct ntfs_inode *ext_ni; + + ext_ni =3D ntfs_extent_inode_open(ni, ale->mft_reference); + if (IS_ERR(ext_ni)) { ntfs_debug("Couldn't attach extent inode.\n"); - return -1; + return PTR_ERR(ext_ni); } prev_attached =3D MREF_LE(ale->mft_reference); } -- 2.51.0 From nobody Sat Sep 26 06:15:31 2026 Received: from m16.mail.163.com (m16.mail.163.com [220.197.31.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1D9C53655EA for ; Fri, 4 Sep 2026 09:01:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=220.197.31.2 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788512501; cv=none; b=mSw7MkxiuQrFz4DqckF/WO+6wU0VdYzj3KcewE9Z7Nk4MQHysVlbbFcQdlwrNb67Xof2NBwuKm977zJwSBsGjXjyzZO8MEEAFW6DeXzmGeUnJ2AUvqUCFS2hudpyS11nQeRQ4CoWFHz6tnXVNbgB29aZSaAd7HV8al4dxGxMhq4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788512501; c=relaxed/simple; bh=nFmFAlfMfvchNY8wxK6eXDlPjjlVlM5IsxUS5faaTzs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YGANcN46cFAnF0wX/goXue5/LV9rO6/YZCPnibwEDjoEie9k4vXaAdhvaA1eIns7Nr9EPPTL1TJdTITRtPv3Nu344NGhwzCxd1OGbf1INOLPEYl4LW7dY4FZPRJ/dkYslW/JhaL1eohWS6Ce0N5P2TIjfez5lRNRuaAi6S6RWb8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com; spf=pass smtp.mailfrom=163.com; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b=W3yrBs7f; arc=none smtp.client-ip=220.197.31.2 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=163.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b="W3yrBs7f" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:To:Subject:Date:Message-ID:MIME-Version; bh=nu j0+1XQbhDECxrIopxhQRoG1J/egygz61nzFEiJBpk=; b=W3yrBs7fwzFqRNOgA1 MEseH6I/LZrHsvJHG2cfBuMw5+m6thAUzwRu6V7xwTOi1+bWYQExAlR/6cfaw1Mc GflyyD7vIibK4VbVxmSoTmp9gvi2PYzM1GyZS06KQqx5iX84l2JhfRxL2tReRWUf 18TmixH6Veid/+UM34OgwD9Zc= Received: from liubaolin-ThinkPad-E15-Gen-2 (unknown []) by gzga-smtp-mtada-g1-4 (Coremail) with SMTP id _____wAHU97ViJpqDNWCAg--.41284S5; Fri, 04 Sep 2026 17:01:20 +0800 (CST) From: Baolin Liu To: linkinjeon@kernel.org, hyc.lee@gmail.com Cc: ntfs@lists.linux.dev, linux-kernel@vger.kernel.org, Baolin Liu Subject: [PATCH v2 3/5] ntfs: preserve the truncate error in ntfs_enlarge_attribute() Date: Fri, 4 Sep 2026 17:00:52 +0800 Message-ID: <20260904090054.3365538-4-liubaolin12138@163.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260904090054.3365538-1-liubaolin12138@163.com> References: <20260904090054.3365538-1-liubaolin12138@163.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CM-TRANSID: _____wAHU97ViJpqDNWCAg--.41284S5 X-Coremail-Antispam: 1Uf129KBjvJXoW7KFy3CF4rCF45CFW7XFWkZwb_yoW8XrW8pr ZrAry7Kw4Fv347Wr1v9a1qq3Wjvay3KrW5tFyq9w1xA3Zxtw1Dt34Fyw10gw4IkrW8X3yj qr48uay7uFy2vrDanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jW9a9UUUUU= X-CM-SenderInfo: xolxutxrol0iasrtmqqrwthudrp/xtbC6QCbZmqaiOCwPQAA3B Content-Type: text/plain; charset="utf-8" From: Baolin Liu ntfs_enlarge_attribute() discards the error from ntfs_attr_truncate() and returns -1, which reaches userspace as EPERM. The discarded codes are meaningful: -ENOSPC when the attribute cannot grow, -EACCES when it is encrypted, -EOPNOTSUPP when compressed, plus -EINVAL and -ENOMEM. Most callers of ntfs_inode_attr_pwrite() compare the result against the requested length and substitute -EIO, masking this. ntfs_ib_write() does not; it returns the value verbatim, which propagates through ntfs_index_add_filename() to __ntfs_create() and __ntfs_link(), so a full volume reports EPERM instead of ENOSPC from create(), mkdir() and link(). Fixes: af0db57d4293 ("ntfs: update inode operations") Signed-off-by: Baolin Liu Reviewed-by: Hyunchul Lee --- fs/ntfs/inode.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fs/ntfs/inode.c b/fs/ntfs/inode.c index 747a60ae27c9..9b2ff15da94c 100644 --- a/fs/ntfs/inode.c +++ b/fs/ntfs/inode.c @@ -3618,9 +3618,10 @@ static inline int ntfs_enlarge_attribute(struct inod= e *vi, s64 pos, s64 count, return -EOPNOTSUPP; =20 if (pos + count > ni->data_size) { - if (ntfs_attr_truncate(ni, pos + count)) { + ret =3D ntfs_attr_truncate(ni, pos + count); + if (ret) { ntfs_debug("Failed to truncate attribute"); - return -1; + return ret; } =20 ntfs_attr_reinit_search_ctx(ctx); --=20 2.51.0 From nobody Sat Sep 26 06:15:31 2026 Received: from m16.mail.163.com (m16.mail.163.com [220.197.31.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EFDF23BF694 for ; Fri, 4 Sep 2026 09:01:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=220.197.31.4 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788512504; cv=none; b=MCQFwDxq3lzByIAwJcFbnSwQJkyswFRcOmI+jWGt3DUkHStXjChBpOoJlw1hY9eZ474gsKeaMjvBuIpjfJd8aP1cN2JCxalEkvrt6A0OZtpLawRtZHkoeMv/JjyNQwvNy/qsHLTNwD2rdUHgdrbBMGVMI2B+0+n22G0OjP0Byw8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788512504; c=relaxed/simple; bh=XvmavsoJmOgyfPZTxe5J2j71CO/TgRB5fQg2I13JxsY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=g/GJmaJUKosf0LlCvgbNKJ+UnewUQ5RJUbd/qMBcPlYGfHDJqTICifeuLShUZbSXDKCeqkCiOS2b+lwBIiQWMx9xLQK0Hmrn35vNXebRfJ3OBlBSSVqPrPwLXxdiA6Dhpc9bwtU2PkiQHJmw5FeSzaLU/eHdGDWr1D4DBL9ekiE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com; spf=pass smtp.mailfrom=163.com; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b=ercQMa44; arc=none smtp.client-ip=220.197.31.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=163.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b="ercQMa44" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:To:Subject:Date:Message-ID:MIME-Version; bh=ot RPBiSqb37i9cnfixkQcyeOL3goWcSLLuXbif4W6OU=; b=ercQMa44OW5iXdQj2H 0hvhZ7qmvJZrbl0W+UxqM1v1+9XLRXY/AQPXFvtdozLnZf4QhzAGGyagc8hzG+oJ B8I+Mv/phAx24CRvbQjpTCNVTKBGMVeqCG9RBtF8wMCe0KiOcuNzgTfQY/nuLx9N uCPv6dQEcOnNqr200TOIJ+iWE= Received: from liubaolin-ThinkPad-E15-Gen-2 (unknown []) by gzga-smtp-mtada-g1-4 (Coremail) with SMTP id _____wAHU97ViJpqDNWCAg--.41284S6; Fri, 04 Sep 2026 17:01:24 +0800 (CST) From: Baolin Liu To: linkinjeon@kernel.org, hyc.lee@gmail.com Cc: ntfs@lists.linux.dev, linux-kernel@vger.kernel.org, Baolin Liu Subject: [PATCH v2 4/5] ntfs: propagate the map_mft_record() error in ntfs_attrlist_entry_add() Date: Fri, 4 Sep 2026 17:00:53 +0800 Message-ID: <20260904090054.3365538-5-liubaolin12138@163.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260904090054.3365538-1-liubaolin12138@163.com> References: <20260904090054.3365538-1-liubaolin12138@163.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CM-TRANSID: _____wAHU97ViJpqDNWCAg--.41284S6 X-Coremail-Antispam: 1Uf129KBjvJXoW7GFy3tr45uF48ZF48AF4DCFg_yoW8Jr4Upa sxAwnrK3WfZr47trs2kay8Aa4v9FWDW3yjvr90934Ivw1rtw40ga4YgFyIqr1FkFW8Jw45 Zr4DWrW3JFW3u3JanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jjD73UUUUU= X-CM-SenderInfo: xolxutxrol0iasrtmqqrwthudrp/xtbCwQWcZ2qaiOX90gAA3N Content-Type: text/plain; charset="utf-8" From: Baolin Liu ntfs_attrlist_entry_add() replaces the map_mft_record() error with -EIO, so an -ENOMEM allocation failure is reported as an I/O error. Both callers pass the value on to ntfs_attr_add(), which no longer collapses it since commit 8efe00b098b5 ("ntfs: preserve error code in ntfs_resident_attr_record_add()"). Return PTR_ERR(ni_mrec) instead. Also fix the debug message. Fixes: 495e90fa3348 ("ntfs: update attrib operations") Signed-off-by: Baolin Liu Reviewed-by: Hyunchul Lee --- fs/ntfs/attrlist.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/ntfs/attrlist.c b/fs/ntfs/attrlist.c index be3086d34338..a1c00e426e80 100644 --- a/fs/ntfs/attrlist.c +++ b/fs/ntfs/attrlist.c @@ -139,8 +139,8 @@ int ntfs_attrlist_entry_add(struct ntfs_inode *ni, stru= ct attr_record *attr) =20 ni_mrec =3D map_mft_record(ni); if (IS_ERR(ni_mrec)) { - ntfs_debug("Invalid arguments.\n"); - return -EIO; + ntfs_debug("Failed to map mft record.\n"); + return PTR_ERR(ni_mrec); } =20 mref =3D MK_LE_MREF(ni->mft_no, le16_to_cpu(ni_mrec->sequence_number)); --=20 2.51.0 From nobody Sat Sep 26 06:15:31 2026 Received: from m16.mail.163.com (m16.mail.163.com [220.197.31.3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 02BC5431A3C for ; Fri, 4 Sep 2026 09:01:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=220.197.31.3 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788512507; cv=none; b=HToWKM0Nv1Z1d2e2d2/BaErajzuVtMlpoQxsskLvSvZ5S8Pl8xf0X7vVraV6puvzkN/SbkQGCgu41zSiDnOkqiK1G6yILLEcXARO/Mptw6rJkzbqgNYxwPvNrbbKhi9AOTcAnhaXpvlTCqKBBIIgOT/xANwHC3VlGhN69hwCQRc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788512507; c=relaxed/simple; bh=x0u4nn+phvIo4zTiyC73ZSVY80IPnQsT5OcowsFdGfw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VCaunThY2ssya1LIrUHvJf73wchkRWUzN6hu7PrTeKOBHITFKCDRu+ay2Eqpj9fRAYsveiukA6HNC6P/ZQVDLDfEqUuiA8QG4d17cS5VT+K2qEIcdpvrY945E+e0kNn4AaXawkwX94JH4Wlyi08bsFM1eQmQ1S8wcfNcmx8xWd4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com; spf=pass smtp.mailfrom=163.com; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b=VVzNP5/T; arc=none smtp.client-ip=220.197.31.3 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=163.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b="VVzNP5/T" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:To:Subject:Date:Message-ID:MIME-Version; bh=mb lHzv1W0QmRiNpHJyRAvAGrR6YKXJiBdzlZw01hfkM=; b=VVzNP5/TOQ7efZ5wI+ G0H7AuOjpIFIEjsQn9d6WLb1viQoq+r2ZhohnINeoCo0l+ToitBQqPkm/tG+BCkX gH1aBxCZeA2sQ/jBwT6Inig/PO5EMRJ1H5nP5LH1lvJpkHQGg1JdV6aRWGpMvcPD F8TMnnVaHPIbsC//MHOKNY26Q= Received: from liubaolin-ThinkPad-E15-Gen-2 (unknown []) by gzga-smtp-mtada-g1-4 (Coremail) with SMTP id _____wAHU97ViJpqDNWCAg--.41284S7; Fri, 04 Sep 2026 17:01:26 +0800 (CST) From: Baolin Liu To: linkinjeon@kernel.org, hyc.lee@gmail.com Cc: ntfs@lists.linux.dev, linux-kernel@vger.kernel.org, Baolin Liu Subject: [PATCH v2 5/5] ntfs: propagate the ntfs_attr_iget() error in update_reparse_data() Date: Fri, 4 Sep 2026 17:00:54 +0800 Message-ID: <20260904090054.3365538-6-liubaolin12138@163.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260904090054.3365538-1-liubaolin12138@163.com> References: <20260904090054.3365538-1-liubaolin12138@163.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CM-TRANSID: _____wAHU97ViJpqDNWCAg--.41284S7 X-Coremail-Antispam: 1Uf129KBjvdXoWrKFy5uw15AFy3ZrW5Kry8Zrb_yoWkCrg_X3 WxJr4qk3WUXFn3Wan3Ca1ayrsYq3W0grnYgrWfKFZFyw4DJr4kXr1kKws5JFWkXrW7Gry5 G3y7KFy5ur13JjkaLaAFLSUrUUUUjb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IU1RVbPUUUUU== X-CM-SenderInfo: xolxutxrol0iasrtmqqrwthudrp/xtbCwgacZ2qaiOYNgAAA3s Content-Type: text/plain; charset="utf-8" From: Baolin Liu update_reparse_data() replaces the ntfs_attr_iget() error with -EINVAL, so an -ENOMEM from iget5_locked() or a read failure from ntfs_read_locked_attr_inode() is reported to userspace as EINVAL. The path is reached from __ntfs_create() via the three ntfs_reparse_set_*() helpers, so symlink() and mknod() are affected. Return PTR_ERR(rp_inode) instead. Fixes: fc053f05ca28 ("ntfs: add reparse and ea operations") Signed-off-by: Baolin Liu Reviewed-by: Hyunchul Lee --- fs/ntfs/reparse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/ntfs/reparse.c b/fs/ntfs/reparse.c index 1a6073e22677..2a6480211fe3 100644 --- a/fs/ntfs/reparse.c +++ b/fs/ntfs/reparse.c @@ -676,7 +676,7 @@ static int update_reparse_data(struct ntfs_inode *ni, s= truct ntfs_index_context =20 rp_inode =3D ntfs_attr_iget(VFS_I(ni), AT_REPARSE_POINT, AT_UNNAMED, 0); if (IS_ERR(rp_inode)) - return -EINVAL; + return PTR_ERR(rp_inode); rp_ni =3D NTFS_I(rp_inode); =20 /* remove the existing reparse data */ --=20 2.51.0