Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp5649273rwi; Tue, 18 Oct 2022 02:03:33 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6RbKSFZt8sdjvzfVd7UT62F34TyeiqE7K7EvQIyDXigMCemk2rtiT6l/l5HAHEdTQIl6tD X-Received: by 2002:a17:906:5daa:b0:78d:fa76:f837 with SMTP id n10-20020a1709065daa00b0078dfa76f837mr1479046ejv.239.1666083812997; Tue, 18 Oct 2022 02:03:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666083812; cv=none; d=google.com; s=arc-20160816; b=eeGOSrukuU4lPL5mrMg27Nxc8cjWWJVloWl2bNZgaYql1LekGE8AjBBR/QefoX4WH5 /golNEYEBUUV7FSsUKeIL4YiB9PdIe6h+od1Tvw8M3MBHNndRTGX8uCN2Pojukc12o1t /TVeUcSiCEDBhwv/1VPX3tAIcGf5FPX3QrFSlUSZ+jdIiiAidkF0Z0L0BMGT9nWCaSTU //JVWJl+WMylLnAp0lheu0REHpZOg7yxUpPByndhguyxFR42V3REo5/RGV+h7vGqoeh2 AQInJMo3ajs4vBsHF/ydlF6BXpE0bi6JRVoRYF7gERZ/LpnMB9NiVGz1OGaRxQkDnzr4 2ZTw== 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 :message-id:date:subject:cc:to:from; bh=/mmQwH/x1B4zRHbNgT0WkSQvGVs3Fa05Qj9slVfbBhk=; b=KbCkdzqH0AolZERcsCJLtcxjlbyZBUiLuZvnL40CuYnSkvT+DRpnz8D1kKhEvPosXX IiId3iTuX01w587WWO2eXWUvAq59QKdFMGErFwl/BqHOx5QJme97+FiG7hJMWGCYXTCy FZtp2uIPR2C5YSP0aKcXOIUVReo5AbnS43YGObSylGZvNuzwF458mFwG/NQnKQb7ePqy YCPVGvKCMLE5Wvv+nhyJL9V/WFSCiTqMzcjWN50NgauSTYrgPLwoKc7OuzTZ5CjIzFXn kELbVNRRRgEZOGCXfEA16THqKG7ETIcTOIB8NMuyapiQGWwj/uA+BkCaDNAbtNBY9jag D3vQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n10-20020a170906724a00b007808f3f4cbcsi9627034ejk.239.2022.10.18.02.03.08; Tue, 18 Oct 2022 02:03:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229890AbiJRIgz (ORCPT + 99 others); Tue, 18 Oct 2022 04:36:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229872AbiJRIgy (ORCPT ); Tue, 18 Oct 2022 04:36:54 -0400 Received: from hust.edu.cn (mail.hust.edu.cn [202.114.0.240]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 39F8952DDB for ; Tue, 18 Oct 2022 01:36:53 -0700 (PDT) Received: from localhost.localdomain ([172.16.0.254]) (user=dzm91@hust.edu.cn mech=LOGIN bits=0) by mx1.hust.edu.cn with ESMTP id 29I8ZX7A019933-29I8ZX7D019933 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 18 Oct 2022 16:35:54 +0800 From: Dongliang Mu To: Dave Kleikamp , Dongliang Mu , Zixuan Fu , Pavel Skripkin Cc: kernel test robot , Dave Kleikamp , jfs-discussion@lists.sourceforge.net, linux-kernel@vger.kernel.org Subject: [PATCH] fs: jfs: use the correct value to do sanity check Date: Tue, 18 Oct 2022 16:33:43 +0800 Message-Id: <20221018083346.855584-1-dzm91@hust.edu.cn> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-FEAS-AUTH-USER: dzm91@hust.edu.cn X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The previous commit 920f4b7e923b ("fs: jfs: fix shift-out-of-bounds in dbAllocAG") incorrectly uses MAXMAPSIZE - L2MAXAG as upper bound to limit bmp->db_agl2size. The right value should be L2MAXL2SIZE - L2MAXAG, i.e., 13 + 10*3 - 7 = 36, according to Dave Kleikamp. Fix this by modifying the upper bound to the correct value. Reported-by: kernel test robot Fixes: 920f4b7e923b ("fs: jfs: fix shift-out-of-bounds in dbAllocAG") Signed-off-by: Dongliang Mu --- fs/jfs/jfs_dmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/jfs/jfs_dmap.c b/fs/jfs/jfs_dmap.c index 962c855631cb..e1cbfbb60303 100644 --- a/fs/jfs/jfs_dmap.c +++ b/fs/jfs/jfs_dmap.c @@ -193,7 +193,7 @@ int dbMount(struct inode *ipbmap) bmp->db_agwidth = le32_to_cpu(dbmp_le->dn_agwidth); bmp->db_agstart = le32_to_cpu(dbmp_le->dn_agstart); bmp->db_agl2size = le32_to_cpu(dbmp_le->dn_agl2size); - if (bmp->db_agl2size > MAXMAPSIZE - L2MAXAG) { + if (bmp->db_agl2size > L2MAXL2SIZE - L2MAXAG) { err = -EINVAL; goto err_release_metapage; } -- 2.35.1