* [PATCH v2] fs: avoid empty option when generating legacy mount string
@ 2023-06-07 17:39 Thomas Weißschuh
2023-06-08 7:34 ` Christian Brauner
0 siblings, 1 reply; 2+ messages in thread
From: Thomas Weißschuh @ 2023-06-07 17:39 UTC (permalink / raw)
To: Alexander Viro, Christian Brauner
Cc: linux-fsdevel, linux-kernel, David Howells, Karel Zak, stable,
Thomas Weißschuh
As each option string fragment is always prepended with a comma it would
happen that the whole string always starts with a comma.
This could be interpreted by filesystem drivers as an empty option and
may produce errors.
For example the NTFS driver from ntfs.ko behaves like this and fails when
mounted via the new API.
Link: https://github.com/util-linux/util-linux/issues/2298
Fixes: 3e1aeb00e6d1 ("vfs: Implement a filesystem superblock creation/configuration context")
Cc: stable@vger.kernel.org
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
Changes in v2:
- Mention Cc stable@ in sign-off area
- Link to v1: https://lore.kernel.org/r/20230607-fs-empty-option-v1-1-20c8dbf4671b@weissschuh.net
---
fs/fs_context.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/fs_context.c b/fs/fs_context.c
index 24ce12f0db32..851214d1d013 100644
--- a/fs/fs_context.c
+++ b/fs/fs_context.c
@@ -561,7 +561,8 @@ static int legacy_parse_param(struct fs_context *fc, struct fs_parameter *param)
return -ENOMEM;
}
- ctx->legacy_data[size++] = ',';
+ if (size)
+ ctx->legacy_data[size++] = ',';
len = strlen(param->key);
memcpy(ctx->legacy_data + size, param->key, len);
size += len;
---
base-commit: 9561de3a55bed6bdd44a12820ba81ec416e705a7
change-id: 20230607-fs-empty-option-265622371023
Best regards,
--
Thomas Weißschuh <linux@weissschuh.net>
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] fs: avoid empty option when generating legacy mount string
2023-06-07 17:39 [PATCH v2] fs: avoid empty option when generating legacy mount string Thomas Weißschuh
@ 2023-06-08 7:34 ` Christian Brauner
0 siblings, 0 replies; 2+ messages in thread
From: Christian Brauner @ 2023-06-08 7:34 UTC (permalink / raw)
To: Thomas Weißschuh
Cc: Alexander Viro, linux-fsdevel, linux-kernel, David Howells,
Karel Zak, stable
On Wed, Jun 07, 2023 at 07:39:09PM +0200, Thomas Weißschuh wrote:
> As each option string fragment is always prepended with a comma it would
> happen that the whole string always starts with a comma.
> This could be interpreted by filesystem drivers as an empty option and
> may produce errors.
>
> For example the NTFS driver from ntfs.ko behaves like this and fails when
> mounted via the new API.
>
> Link: https://github.com/util-linux/util-linux/issues/2298
> Fixes: 3e1aeb00e6d1 ("vfs: Implement a filesystem superblock creation/configuration context")
> Cc: stable@vger.kernel.org
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
> ---
Applied a fixed up version of v1 to
tree: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs.misc
[1/1] fs: avoid empty option when generating legacy mount string
https://git.kernel.org/vfs/vfs/c/36851649d3f6
yesterday.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-06-08 7:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-07 17:39 [PATCH v2] fs: avoid empty option when generating legacy mount string Thomas Weißschuh
2023-06-08 7:34 ` Christian Brauner
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.