]> www.infradead.org Git - users/hch/xfs.git/commit
statmount: let unset strings be empty
authorMiklos Szeredi <mszeredi@redhat.com>
Thu, 30 Jan 2025 12:15:00 +0000 (13:15 +0100)
committerChristian Brauner <brauner@kernel.org>
Fri, 7 Feb 2025 09:27:24 +0000 (10:27 +0100)
commite52e97f09fb66fd868260d05bd6b74a9a3db39ee
tree1eba446b26bf23e609d2587e0535e609ecb0750d
parent4e7487245abcbc5a1a1aea54e4d3b33c53804bda
statmount: let unset strings be empty

Just like it's normal for unset values to be zero, unset strings should be
empty instead of containing random values.

It seems to be a typical mistake that the mask returned by statmount is not
checked, which can result in various bugs.

With this fix, these bugs are prevented, since it is highly likely that
userspace would just want to turn the missing mask case into an empty
string anyway (most of the recently found cases are of this type).

Link: https://lore.kernel.org/all/CAJfpegsVCPfCn2DpM8iiYSS5DpMsLB8QBUCHecoj6s0Vxf4jzg@mail.gmail.com/
Fixes: 68385d77c05b ("statmount: simplify string option retrieval")
Fixes: 46eae99ef733 ("add statmount(2) syscall")
Cc: stable@vger.kernel.org # v6.8
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Link: https://lore.kernel.org/r/20250130121500.113446-1-mszeredi@redhat.com
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Christian Brauner <brauner@kernel.org>
fs/namespace.c