Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp2349342rda; Tue, 24 Oct 2023 23:09:49 -0700 (PDT) X-Google-Smtp-Source: AGHT+IELpyLZ9d0N4Nb7fwZTROJ2owGdSDKs4O6jOf8baSOxQ5ixUrJb068VK9oD4iSMRgScvhVX X-Received: by 2002:a25:2688:0:b0:d84:e7a6:fc09 with SMTP id m130-20020a252688000000b00d84e7a6fc09mr13712131ybm.17.1698214189128; Tue, 24 Oct 2023 23:09:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698214189; cv=none; d=google.com; s=arc-20160816; b=dyhIKOef/ZdnPuFOxNsxfV5UxExWCOs8aVbUalz/pt6PN4Hz9nANmib4r1P1lbUi7U tqcq09hTjmpD1bEgSENOH5C1E+7e0lcti9RU86F3ZBNDJOVVE7rzEVOWjS+r/Pp3BYeM daxFs5rwt1QrYcHyn73YdY3CJQtHRjSfngWFqK5qxRHBsihbghmW3H00y+rmVYyxMy1P T+lRHai2WUHlJyafgVJ+1NErEN1HcLbg23h4wl2Bq1ZiQJu+/+oLj/Ya2QdvJ+80iRm+ ZUA6zUx2h0KElARRjgEzDVsJrcjshlC7KzbxCg12/fUDtaSvFo8Mu4wJj8JEKqCAyQ3W 8Zzg== 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:dkim-signature; bh=DOzMC9JnINWc5MYbwZ7TC8/K6W3nb2Ih949g1iEUhFo=; fh=kY9zhpfsPbtncnbmir5MiWQpU06hueYWZiSAL3in6JQ=; b=OHiuQgCmSuIOOp1r/7CWma9WkVBwZNgvlTkJHs22sS23o4IoLmnsmIwE8P9IzCAr5i r5bdzzB7AsXCtKS7DLK2pxMgxXKBA4xY5ichOOs02quEzYma0cm/Ce3aacqLTNTIFNnF IiWVQSkkeNTc/TO32ZyVjs5zV6DnhZ+bx3aPyXSyWhK6yupFjXpst993+2L+ULhG84Vf g3nFUIBu8ZCyeDQItpdPp7doUdZGXsqaqr9CvkazmFf+MrJYbJXhxjB76XqvDkrnJADx Kjsvd/Br5D6AeMm0Zf+8p6MunxEoJ+S5aKT8KZI6zBrN5wZNx+qz0Mariws/Z7Zpi/V/ WBcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=a7Fwmswe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id x14-20020a056902102e00b00d9940128dd1si3106893ybt.738.2023.10.24.23.09.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 23:09:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=a7Fwmswe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-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 pete.vger.email (Postfix) with ESMTP id 8E0EB8029B54; Tue, 24 Oct 2023 23:09:40 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231254AbjJYGJS (ORCPT + 99 others); Wed, 25 Oct 2023 02:09:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45206 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229498AbjJYGJR (ORCPT ); Wed, 25 Oct 2023 02:09:17 -0400 Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 178E49D for ; Tue, 24 Oct 2023 23:09:15 -0700 (PDT) Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-1c9fa869a63so34567115ad.0 for ; Tue, 24 Oct 2023 23:09:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698214154; x=1698818954; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=DOzMC9JnINWc5MYbwZ7TC8/K6W3nb2Ih949g1iEUhFo=; b=a7Fwmswe2R6BA242HyaxkWSPKCzrgHr5RZvM6TrPAmwocaYpEsKMLiCLpSDjdAPYl4 TfSeYwmFoEs26xEaYmKYlkzOOtXoTNcv031rE8XTdRzf5Q0FPsVSVTYch09Lsm1U11tv mVGNDJ1l1vCkoSBbGC/X+sqPUnSlXDpBg67SU0F9VCu8X+TE8XEhyhBwcSATC112PnG5 EjpYci0R8gC11WTQczeW+tZTFI70eBS7UfdxXx9Dibq8CxbLe7NMepCJgVSkKFhytrTg HviMMVKWKC+GZSJuzUjCY50BHpOPFWidRLXzA5AwYWum7EhR+EZy7/rQD12Yr3PMGYyY 00lQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698214154; x=1698818954; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=DOzMC9JnINWc5MYbwZ7TC8/K6W3nb2Ih949g1iEUhFo=; b=WKQjMUi5HdwY7v8X42BawulTFCn+axbC+q+D80FhO9IJ9PyV1uEk4o7zuhlhN7i3ur pAZVP2h4pD2FimrBhZHGbc7Z6cTV7C6xwcTsfNkpAKMkvgjIlVFwOyltFHU8GYNQ9JP/ dpQtcomspaEpGd9cS0rVhaRKT7w7H8oR2yqrltZ4YUOjtycUZGnsO6VgATzT1zenknzK U5wbGJeCKMYUTP5vQe4zTev+YCVN8gn3KhJT56S1hr/Sh7FmFfqUUUgaWdC8E7k19n2F SKTnZPGznUpHltk4nONkj9T+iGQD3CCW50n85HW4vGI2Wj0OjEBAlyuHMVB8w3uSxlJ6 /XXQ== X-Gm-Message-State: AOJu0Yyq8ItRZI/EM2sRl/JjwtDvFdDMO/FrydOirsYpUgCD1QhnmteO CAETPIng0f0uyawIGkN4xEQ= X-Received: by 2002:a17:902:c404:b0:1c7:8345:f377 with SMTP id k4-20020a170902c40400b001c78345f377mr15172079plk.29.1698214154398; Tue, 24 Oct 2023 23:09:14 -0700 (PDT) Received: from manas-VirtualBox.iitr.ac.in ([103.37.201.173]) by smtp.gmail.com with ESMTPSA id x4-20020a170902ea8400b001c723d6c410sm8380067plb.16.2023.10.24.23.09.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 23:09:14 -0700 (PDT) From: Manas Ghandat To: dan.carpenter@linaro.org, dave.kleikamp@oracle.com, shaggy@kernel.org Cc: Manas Ghandat , Linux-kernel-mentees@lists.linuxfoundation.org, jfs-discussion@lists.sourceforge.net, linux-kernel@vger.kernel.org, lkp@intel.com, oe-kbuild-all@lists.linux.dev, oe-kbuild@lists.linux.dev Subject: [PATCH-v2] jfs: fix slab-out-of-bounds Read in dtSearch Date: Wed, 25 Oct 2023 11:39:07 +0530 Message-Id: <20231025060907.115675-1-ghandatmanas@gmail.com> X-Mailer: git-send-email 2.37.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Tue, 24 Oct 2023 23:09:40 -0700 (PDT) Currently while searching for current page in the sorted entry table of the page there is a out of bound access. Added a bound check to fix the error. Reported-by: kernel test robot Reported-by: Dan Carpenter Closes: https://lore.kernel.org/r/202310241724.Ed02yUz9-lkp@intel.com/ Signed-off-by: Manas Ghandat --- V1 -> V2 : Removed redundant check on stbl fs/jfs/jfs_dtree.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/jfs/jfs_dtree.c b/fs/jfs/jfs_dtree.c index 92b7c533407c..cf67d32d5b7f 100644 --- a/fs/jfs/jfs_dtree.c +++ b/fs/jfs/jfs_dtree.c @@ -633,6 +633,9 @@ int dtSearch(struct inode *ip, struct component_name * key, ino_t * data, for (base = 0, lim = p->header.nextindex; lim; lim >>= 1) { index = base + (lim >> 1); + if (stbl[index] < 0) + goto out; + if (p->header.flag & BT_LEAF) { /* uppercase leaf name to compare */ cmp = -- 2.37.2