public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [REPOST PATCH v3 0/2] vfs: fix a mount table handling problem
@ 2022-09-20  7:26 Ian Kent
  2022-09-20  7:26 ` [REPOST PATCH v3 1/2] ext4: fix possible null pointer dereference Ian Kent
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Ian Kent @ 2022-09-20  7:26 UTC (permalink / raw)
  To: Al Viro
  Cc: Andrew Morton, Siddhesh Poyarekar, David Howells, Miklos Szeredi,
	Carlos Maiolino, linux-fsdevel, Kernel Mailing List

Whenever a mount has an empty "source" (aka mnt_fsname), the glibc
function getmntent incorrectly parses its input, resulting in reporting
incorrect data to the caller.

The problem is that the get_mnt_entry() function in glibc's
misc/mntent_r.c assumes that leading whitespace on a line can always
be discarded because it will always be followed by a # for the case
of a comment or a non-whitespace character that's part of the value
of the first field. However, this assumption is violated when the
value of the first field is an empty string.

This is fixed in the mount API code by simply checking for a pointer
that contains a NULL and treating it as a NULL pointer.

Changes:

v3: added patch to fix zero length string access violation caused after
    fs parser patch is applied.

v2: fix possible oops if conversion functions such as fs_param_is_u32()
    are called.

Signed-off-by: Ian Kent <raven@themaw.net>
---

Ian Kent (2):
      ext4: fix possible null pointer dereference
      vfs: parse: deal with zero length string value


 fs/ext4/super.c            |  4 ++--
 fs/fs_context.c            | 17 ++++++++++++-----
 fs/fs_parser.c             | 16 ++++++++++++++++
 include/linux/fs_context.h |  3 ++-
 4 files changed, 32 insertions(+), 8 deletions(-)

--
Ian


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

end of thread, other threads:[~2022-10-18  2:09 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-20  7:26 [REPOST PATCH v3 0/2] vfs: fix a mount table handling problem Ian Kent
2022-09-20  7:26 ` [REPOST PATCH v3 1/2] ext4: fix possible null pointer dereference Ian Kent
2022-09-20  7:26 ` [REPOST PATCH v3 2/2] vfs: parse: deal with zero length string value Ian Kent
2022-10-18  1:55   ` Andrew Morton
2022-10-18  2:07     ` Ian Kent
2022-09-21  1:20 ` [REPOST PATCH v3 0/2] vfs: fix a mount table handling problem Theodore Ts'o
2022-09-21  4:38   ` Ian Kent
2022-09-21  5:35     ` Ian Kent

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox