diff mbox series

[v3,1/2] ext4: fix possible null pointer dereference

Message ID 165871184279.22404.4501431417766210690.stgit@donald.themaw.net (mailing list archive)
State New
Headers show
Series vfs: fix a mount table handling problem | expand

Commit Message

Ian Kent July 25, 2022, 1:17 a.m. UTC
It could be the case that the file system parameter ->string value is
NULL rather than a zero length string.

Guard against this possibility in ext4_parse_param().

Reported-by: kernel test robot <oliver.sang@intel.com>
Signed-off-by: Ian Kent <raven@themaw.net>
 fs/ext4/super.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series


diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 845f2f8aee5f..97160e982ced 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -2110,12 +2110,12 @@  static int ext4_parse_param(struct fs_context *fc, struct fs_parameter *param)
 	switch (token) {
 	case Opt_usrjquota:
-		if (!*param->string)
+		if (!param->string || !*param->string)
 			return unnote_qf_name(fc, USRQUOTA);
 			return note_qf_name(fc, USRQUOTA, param);
 	case Opt_grpjquota:
-		if (!*param->string)
+		if (!param->string || !*param->string)
 			return unnote_qf_name(fc, GRPQUOTA);
 			return note_qf_name(fc, GRPQUOTA, param);