linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] hfsplus: return EIO when type of hidden directory mismatch in hfsplus_fill_super()
@ 2025-08-05 16:58 Yangtao Li
  2025-08-08 20:00 ` Viacheslav Dubeyko
  0 siblings, 1 reply; 2+ messages in thread
From: Yangtao Li @ 2025-08-05 16:58 UTC (permalink / raw)
  To: slava, glaubitz, Yangtao Li; +Cc: linux-fsdevel, linux-kernel

If Catalog File contains corrupted record for the case of
hidden directory's type, regard it as I/O error instead of
Invalid argument.

Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
 fs/hfsplus/super.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/hfsplus/super.c b/fs/hfsplus/super.c
index 86351bdc8985..55f42b349a5e 100644
--- a/fs/hfsplus/super.c
+++ b/fs/hfsplus/super.c
@@ -524,7 +524,7 @@ static int hfsplus_fill_super(struct super_block *sb, struct fs_context *fc)
 	if (!hfs_brec_read(&fd, &entry, sizeof(entry))) {
 		hfs_find_exit(&fd);
 		if (entry.type != cpu_to_be16(HFSPLUS_FOLDER)) {
-			err = -EINVAL;
+			err = -EIO;
 			goto out_put_root;
 		}
 		inode = hfsplus_iget(sb, be32_to_cpu(entry.folder.id));
-- 
2.48.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] hfsplus: return EIO when type of hidden directory mismatch in hfsplus_fill_super()
  2025-08-05 16:58 [PATCH] hfsplus: return EIO when type of hidden directory mismatch in hfsplus_fill_super() Yangtao Li
@ 2025-08-08 20:00 ` Viacheslav Dubeyko
  0 siblings, 0 replies; 2+ messages in thread
From: Viacheslav Dubeyko @ 2025-08-08 20:00 UTC (permalink / raw)
  To: Yangtao Li, glaubitz; +Cc: linux-fsdevel, linux-kernel

On Tue, 2025-08-05 at 10:58 -0600, Yangtao Li wrote:
> If Catalog File contains corrupted record for the case of
> hidden directory's type, regard it as I/O error instead of
> Invalid argument.
> 
> Signed-off-by: Yangtao Li <frank.li@vivo.com>
> ---
>  fs/hfsplus/super.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/hfsplus/super.c b/fs/hfsplus/super.c
> index 86351bdc8985..55f42b349a5e 100644
> --- a/fs/hfsplus/super.c
> +++ b/fs/hfsplus/super.c
> @@ -524,7 +524,7 @@ static int hfsplus_fill_super(struct super_block
> *sb, struct fs_context *fc)
>  	if (!hfs_brec_read(&fd, &entry, sizeof(entry))) {
>  		hfs_find_exit(&fd);
>  		if (entry.type != cpu_to_be16(HFSPLUS_FOLDER)) {
> -			err = -EINVAL;
> +			err = -EIO;

Potentially, we could consider to add an error or warning message that
informs a user about file system corruption.

>  			goto out_put_root;
>  		}
>  		inode = hfsplus_iget(sb,
> be32_to_cpu(entry.folder.id));

Looks good.

Reviewed-by: Viacheslav Dubeyko <slava@dubeyko.com>

Thanks,
Slava.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-08-08 20:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-05 16:58 [PATCH] hfsplus: return EIO when type of hidden directory mismatch in hfsplus_fill_super() Yangtao Li
2025-08-08 20:00 ` Viacheslav Dubeyko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).