linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Edward AD <twuufnxlz@gmail.com>
To: syzbot+9cf75dc581fb4307d6dd@syzkaller.appspotmail.com
Cc: adilger.kernel@dilger.ca, ebiggers@google.com,
	krisman@collabora.com, linux-ext4@vger.kernel.org,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	syzkaller-bugs@googlegroups.com, tytso@mit.edu
Subject: [PATCH] unicode: add s_encoding null ptr check in utf8ncursor
Date: Wed, 20 Sep 2023 19:20:16 +0800	[thread overview]
Message-ID: <20230920112015.829124-2-twuufnxlz@gmail.com> (raw)
In-Reply-To: <0000000000001f0b970605c39a7e@google.com>

When init struct utf8cursor *u8c in utf8ncursor(), we need check um is
valid.

Reported-and-tested-by: syzbot+9cf75dc581fb4307d6dd@syzkaller.appspotmail.com
Fixes: b81427939590 ("ext4: remove redundant checks of s_encoding")
Signed-off-by: Edward AD <twuufnxlz@gmail.com>
---
 fs/unicode/utf8-norm.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/fs/unicode/utf8-norm.c b/fs/unicode/utf8-norm.c
index 768f8ab448b8..906b639b2f38 100644
--- a/fs/unicode/utf8-norm.c
+++ b/fs/unicode/utf8-norm.c
@@ -422,6 +422,10 @@ int utf8ncursor(struct utf8cursor *u8c, const struct unicode_map *um,
 {
 	if (!s)
 		return -1;
+
+	if (IS_ERR_OR_NULL(um))
+		return -1;
+
 	u8c->um = um;
 	u8c->n = n;
 	u8c->s = s;
-- 
2.25.1


  parent reply	other threads:[~2023-09-20 11:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-20  5:25 [syzbot] [ext4?] general protection fault in utf8nlookup syzbot
2023-09-20  7:36 ` Eric Biggers
2023-09-20 11:20 ` Edward AD [this message]
2023-09-20 19:37   ` [PATCH] unicode: add s_encoding null ptr check in utf8ncursor Eric Biggers
2024-02-13  0:24 ` [syzbot] [ext4?] general protection fault in utf8nlookup syzbot
2024-02-13 10:42   ` Jan Kara

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230920112015.829124-2-twuufnxlz@gmail.com \
    --to=twuufnxlz@gmail.com \
    --cc=adilger.kernel@dilger.ca \
    --cc=ebiggers@google.com \
    --cc=krisman@collabora.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=syzbot+9cf75dc581fb4307d6dd@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).