Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp1331356rdb; Wed, 20 Sep 2023 06:27:39 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE07zDtyLLNvV76a2b9WagLtm46zSrDlwMWRLXeHPu7oqStW3GRYZ/a/+4IntmphId7Eu7L X-Received: by 2002:a05:6870:d60c:b0:1d6:c7e7:abb5 with SMTP id a12-20020a056870d60c00b001d6c7e7abb5mr2603995oaq.54.1695216458736; Wed, 20 Sep 2023 06:27:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695216458; cv=none; d=google.com; s=arc-20160816; b=kpTxp3HLI1Uzkln8wsL7tUpUv/TBBwjGwJaM3qrgA/eTnV/BNjp62b5etxk8nERITb 4sBWzDbM/j2Mf2lW9JfrwBGCEw1iNt03FvYeRHOiqVRYFchCyJNWhCkZ7cad7ep/t/z/ Mt30MNl07JqfiUkCISHJJNcFEqK/lJtqd5zNnARccV27Vh11Z07Ujgf9d3z23qclUmXv Y/pKXcn1ZzpSX/vnxw68Ps+nLHCUZmj7NQd8HxZTUGXVukrudqyJqlwhdLlH0idGWMQF EOLJcCRb7IFuTLX/LuDJkfFbsgO2RDc8d9KuhDd0bLmri3akt7C3hd2vhn5JgEAPXs2K JzqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=QrYaQMi129MfXVncu6BToQxK7QswkFgAkNIRkcmNulM=; fh=oOHSvZHEX9RfLe3zEqCEOFOiNPx//54Ql/1XRn3SiPk=; b=uiHKf+UHHJsb3cgZDUIPRelxvnIVavy2fbeSW+WZaGtXw/EnZxIHI7/Wswhqrs/sH2 3AEnorfUlOiXi1GC8K4Ye/RVlB0rnwn82K6PvQ5r/oQTDNuSlQ4NuhBOynD7mZHD8gk7 THiCxDu4sxBGFNuvLHdpuaskdeZ4SKeOSvM0x8Po8odUyWsEnz3+qGF+M/EYVOYATYwd xedQmFJpN8n3IHNTK+sFLg6DRzMXufVfex/E7iWOmSs8ssD1QX3rJphEO6M2pg5NqPdq UOzZP7/IpwgS0h0xevvwCSRygKGsyYJ5Mqggp7K+RuE1RJiW8/aLTW7GHrsygo7XYUBA Ro9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=dTQeUX8Y; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id a35-20020a631a63000000b00565218f25c4si11470488pgm.858.2023.09.20.06.27.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Sep 2023 06:27:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=dTQeUX8Y; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id C8FBA80ABDE0; Wed, 20 Sep 2023 04:20:31 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234336AbjITLUe (ORCPT + 99 others); Wed, 20 Sep 2023 07:20:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60016 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233615AbjITLUd (ORCPT ); Wed, 20 Sep 2023 07:20:33 -0400 Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EB8FEA1; Wed, 20 Sep 2023 04:20:23 -0700 (PDT) Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-1c465d59719so28818355ad.1; Wed, 20 Sep 2023 04:20:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695208823; x=1695813623; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=QrYaQMi129MfXVncu6BToQxK7QswkFgAkNIRkcmNulM=; b=dTQeUX8YlbBW6F+wjIxvhuWEx2q8giHxzQQzXKRDC2mEoi3eBJKBpqaKGZUQjikR3c ohDX7oCD9IDzV2s2rFNoYkAdHwRbMlzXIJs/JBhC6+sMNvnUNMouEUzxZGoWEijT9I0w 5E5+X5v4Z9yO6jIYtE/NTfAbXEPjRev8bQwtaVh/eSJy8PTkWLwLI7TUJiwuicHoH+Ko BW7C0yxdKAn3nr07Pe/y3U1TyWvcQuoUnMFq9UrGkzQ00+oiCYxYfyIfYnG5zimcPs2I ZdcF8ZierNyM634PDmqeyeOPZBy0fY1D7rME1fm7/MjF4lvPJkryFPzfH1EBSJWLnNeH xV4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695208823; x=1695813623; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QrYaQMi129MfXVncu6BToQxK7QswkFgAkNIRkcmNulM=; b=RfdahbLUbIaEx+TB2CioB5VoVNupDwx4KQA8nlF1PEDS3RywJ0qSapkUTlpZwWkBeT umttIZNFObKTjOQtmOe1lcn0Q+N/KE6bZ9iQrBHjNrA+TwGVWY/yPYl7snFkuO/9JMxm xSoTyt58NoYJloJAPdPybOSMbRB4Nx3zFnPa/P5cZwuc/OVrauIkDq1xtlpKFkwcAHV4 Qexe5DNFZIh0UuqJsTtJwpTi9AsxynH8EJykfCGNKCn/1gVu6OvxCEbJiavHn5BaOpUt bc4FWxNB9GEMEdp5Jo1ebXMZcqdjJhyrwRRov8bIccYb9wZKSJ5sjikVhPjoL3xTRQy8 lq/w== X-Gm-Message-State: AOJu0YxKnFb73pnU4DY59UMcIjLwafsjAMM7lztbG0BFDUUS+2mjYfGf kL/P4cjBk8zBNs+FtBpyhB0= X-Received: by 2002:a17:902:d503:b0:1c0:b8fd:9c7 with SMTP id b3-20020a170902d50300b001c0b8fd09c7mr2418167plg.43.1695208823377; Wed, 20 Sep 2023 04:20:23 -0700 (PDT) Received: from pek-lxu-l1.wrs.com ([111.198.228.56]) by smtp.gmail.com with ESMTPSA id iy13-20020a170903130d00b001bdd512df9csm7968397plb.74.2023.09.20.04.20.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Sep 2023 04:20:22 -0700 (PDT) From: Edward AD 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 Message-ID: <20230920112015.829124-2-twuufnxlz@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <0000000000001f0b970605c39a7e@google.com> References: <0000000000001f0b970605c39a7e@google.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=1.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,HK_RANDOM_FROM,MAILING_LIST_MULTI, SORTED_RECIPS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Wed, 20 Sep 2023 04:20:31 -0700 (PDT) X-Spam-Level: * 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 --- 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